Skip to content

Commit

Permalink
feat: update dapps rules (#318)
Browse files Browse the repository at this point in the history
* feat: update dapps rules

* feat: update dapps rules
  • Loading branch information
braianj authored Jul 16, 2024
1 parent fcb4128 commit 00cd6d2
Showing 1 changed file with 141 additions and 56 deletions.
197 changes: 141 additions & 56 deletions dapps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,89 +4,174 @@ module.exports = {
browser: true,
es6: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'import'],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
plugins: ["@typescript-eslint", "import", "autofix"],
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
"eslint:recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
rules: {
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/ban-tslint-comment': 'error',
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true }],
'@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', ignoreRestSiblings: true }],
'@typescript-eslint/unbound-method': 'error',
'@typescript-eslint/naming-convention': [
'error',
{ selector: 'default', format: ['camelCase'] },
{ selector: 'variableLike', format: ['camelCase'] },
{ selector: 'variable', format: ['camelCase', 'UPPER_CASE'], leadingUnderscore: 'allow' },
{ selector: 'variable', types: ['function'], format: ['PascalCase', 'camelCase'] },
{ selector: 'parameter', format: ['camelCase'], leadingUnderscore: 'allow' },
{ selector: 'memberLike', format: ['camelCase'] },
{ selector: 'memberLike', modifiers: ['private'], format: ['camelCase'], leadingUnderscore: 'allow' },
{ selector: 'typeLike', format: ['PascalCase'] },
{ selector: 'typeParameter', format: ['PascalCase'], prefix: ['T'] },
{ selector: 'interface', format: ['PascalCase'], custom: { regex: '^I[A-Z]', match: false } },
"react/display-name": "off",
"import/no-named-as-default-member": "off",
"import/no-default-export": "error",
"import/group-exports": "error",
"import/exports-last": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/ban-tslint-comment": "error",
"@typescript-eslint/quotes": ["error", "single", { avoidEscape: true }],
"@typescript-eslint/no-misused-promises": [
"error",
{ checksVoidReturn: false },
],
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", ignoreRestSiblings: true },
],
"@typescript-eslint/unbound-method": "error",
"@typescript-eslint/naming-convention": [
"error",
{ selector: "default", format: ["camelCase"] },
{ selector: "variableLike", format: ["camelCase"] },
{
selector: "variable",
format: ["camelCase", "UPPER_CASE"],
leadingUnderscore: "allow",
},
{
selector: "variable",
types: ["function"],
format: ["PascalCase", "camelCase"],
},
{
selector: "parameter",
format: ["camelCase"],
leadingUnderscore: "allow",
},
{ selector: "memberLike", format: ["camelCase"] },
{
selector: ['variable', 'function', 'objectLiteralProperty', 'objectLiteralMethod'],
types: ['function'],
format: ['StrictPascalCase', 'strictCamelCase'],
selector: "memberLike",
modifiers: ["private"],
format: ["camelCase"],
leadingUnderscore: "allow",
},
{ selector: "typeLike", format: ["PascalCase"] },
{ selector: "typeParameter", format: ["PascalCase"], prefix: ["T"] },
{
selector: "interface",
format: ["PascalCase"],
custom: { regex: "^I[A-Z]", match: false },
},
{
selector: [
"variable",
"function",
"objectLiteralProperty",
"objectLiteralMethod",
],
types: ["function"],
format: ["StrictPascalCase", "strictCamelCase"],
},
{
selector: ["enum"],
format: ["UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
},
{
selector: ["enumMember"],
format: ["UPPER_CASE"],
leadingUnderscore: "allow",
},
{ selector: ['enum'], format: ['UPPER_CASE', 'PascalCase'], leadingUnderscore: 'allow' },
{ selector: ['enumMember'], format: ['UPPER_CASE'], leadingUnderscore: 'allow' },
],
'import/order': [
'error',
"autofix/no-debugger": "error",
"sort-imports": [
"error",
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object'],
pathGroupsExcludedImportTypes: ['react', 'react-*/**', 'react-*', '@dcl/**', 'decentraland-*/**', 'decentraland-*'],
ignoreDeclarationSort: true, // don't want to sort import lines, use eslint-plugin-import instead
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
allowSeparatedGroups: true,
},
],
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
],
pathGroupsExcludedImportTypes: [
"react",
"react-*/**",
"react-*",
"@dcl/**",
"decentraland-*/**",
"decentraland-*",
"@mui/*",
"@dcl/schemas/*",
"@emotion/*",
],
pathGroups: [
{ pattern: 'react', group: 'builtin', position: 'before' },
{ pattern: 'react-*/**', group: 'builtin' },
{ pattern: 'react-*', group: 'builtin' },
{ pattern: '@dcl/**', group: 'external', position: 'after' },
{ pattern: 'decentraland-*/**', group: 'external', position: 'after' },
{ pattern: 'decentraland-*', group: 'external', position: 'after' },
{ pattern: 'lib/**', group: 'internal', position: 'before' },
{ pattern: 'modules/**', group: 'internal', position: 'before' },
{ pattern: 'components/**', group: 'internal', position: 'after' },
{ pattern: './*.types', group: 'sibling', position: 'after' },
{ pattern: './*.css', group: 'sibling', position: 'after' },
{ pattern: "react", group: "builtin", position: "before" },
{ pattern: "react-*/**", group: "builtin" },
{ pattern: "react-*", group: "builtin" },
{ pattern: "@dcl/**", group: "external", position: "after" },
{
pattern: "decentraland-*/**",
group: "external",
position: "after",
},
{ pattern: "decentraland-*", group: "external", position: "after" },
{ pattern: "@mui/*", group: "internal" },
{ pattern: "@emotion/*", group: "internal" },
{ pattern: "@dcl/schemas/*", group: "internal" },
{ pattern: "lib/**", group: "internal", position: "before" },
{ pattern: "modules/**", group: "internal", position: "before" },
{ pattern: "components/**", group: "internal", position: "after" },
{ pattern: "./*.types", group: "sibling", position: "after" },
{ pattern: "./*.styled", group: "sibling", position: "after" },
{ pattern: "./*.css", group: "sibling", position: "after" },
],
distinctGroup: false,
'newlines-between': 'never',
"newlines-between": "never",
alphabetize: {
order: 'asc',
order: "asc",
caseInsensitive: true,
orderImportKind: 'desc',
orderImportKind: "desc",
},
warnOnUnassignedImports: true,
},
],
'prettier/prettier': [
'error',
"prettier/prettier": [
"error",
{
semi: false,
singleQuote: true,
printWidth: 140,
tabWidth: 2,
trailingComma: 'none',
arrowParens: 'avoid',
trailingComma: "none",
arrowParens: "avoid",
},
],
},
settings: {
'import/resolver': {
"import/resolver": {
typescript: true,
node: {
paths: ['./src'],
paths: ["./src"],
},
},
},
}
};

0 comments on commit 00cd6d2

Please sign in to comment.