From 8e3bff12eb616b0e8c4d427594bedf06db653434 Mon Sep 17 00:00:00 2001 From: Braian Mellor Date: Tue, 9 Jul 2024 11:19:52 -0300 Subject: [PATCH 1/2] feat: update dapps rules --- dapps.js | 190 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 134 insertions(+), 56 deletions(-) diff --git a/dapps.js b/dapps.js index 39260d8..c3a7232 100644 --- a/dapps.js +++ b/dapps.js @@ -4,89 +4,167 @@ 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-*", + ], 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: "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" }, ], 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"], }, }, }, -} +}; From c24a76ddff4098c62a428325ba455eaf9cc1f201 Mon Sep 17 00:00:00 2001 From: Braian Mellor Date: Tue, 9 Jul 2024 11:25:01 -0300 Subject: [PATCH 2/2] feat: update dapps rules --- dapps.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dapps.js b/dapps.js index c3a7232..437b3c0 100644 --- a/dapps.js +++ b/dapps.js @@ -119,6 +119,9 @@ module.exports = { "@dcl/**", "decentraland-*/**", "decentraland-*", + "@mui/*", + "@dcl/schemas/*", + "@emotion/*", ], pathGroups: [ { pattern: "react", group: "builtin", position: "before" }, @@ -131,10 +134,14 @@ module.exports = { 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,