|
| 1 | +module.exports = { |
| 2 | + extends: [ |
| 3 | + "eslint:recommended", |
| 4 | + "plugin:import/recommended", |
| 5 | + "plugin:prettier/recommended", |
| 6 | + ], |
| 7 | + ignorePatterns: ["**/cdk.out/**", "**/dist/**"], |
| 8 | + rules: { |
| 9 | + "prettier/prettier": "error", |
| 10 | + "import/extensions": 0, |
| 11 | + "import/no-unresolved": 0, |
| 12 | + "import/prefer-default-export": 0, |
| 13 | + "import/no-duplicates": "error", |
| 14 | + complexity: ["error", 8], |
| 15 | + "max-lines": ["error", { max: 200, skipBlankLines: true }], |
| 16 | + "max-depth": ["error", 3], |
| 17 | + "max-params": ["error", 6], |
| 18 | + eqeqeq: ["error", "smart"], |
| 19 | + "import/no-extraneous-dependencies": [ |
| 20 | + "error", |
| 21 | + { |
| 22 | + devDependencies: true, |
| 23 | + optionalDependencies: false, |
| 24 | + peerDependencies: false, |
| 25 | + }, |
| 26 | + ], |
| 27 | + "no-shadow": [ |
| 28 | + "error", |
| 29 | + { |
| 30 | + hoist: "all", |
| 31 | + }, |
| 32 | + ], |
| 33 | + "prefer-const": "error", |
| 34 | + "import/order": [ |
| 35 | + "error", |
| 36 | + { |
| 37 | + groups: [ |
| 38 | + ["external", "builtin"], |
| 39 | + "unknown", |
| 40 | + "internal", |
| 41 | + ["parent", "sibling", "index"], |
| 42 | + ], |
| 43 | + alphabetize: { |
| 44 | + order: "asc", |
| 45 | + caseInsensitive: false, |
| 46 | + }, |
| 47 | + "newlines-between": "always", |
| 48 | + pathGroupsExcludedImportTypes: ["builtin"], |
| 49 | + }, |
| 50 | + ], |
| 51 | + "sort-imports": [ |
| 52 | + "error", |
| 53 | + { |
| 54 | + ignoreCase: true, |
| 55 | + ignoreDeclarationSort: true, |
| 56 | + ignoreMemberSort: false, |
| 57 | + memberSyntaxSortOrder: ["none", "all", "multiple", "single"], |
| 58 | + }, |
| 59 | + ], |
| 60 | + "padding-line-between-statements": [ |
| 61 | + "error", |
| 62 | + { |
| 63 | + blankLine: "always", |
| 64 | + prev: "*", |
| 65 | + next: "return", |
| 66 | + }, |
| 67 | + ], |
| 68 | + "prefer-arrow/prefer-arrow-functions": [ |
| 69 | + "error", |
| 70 | + { |
| 71 | + disallowPrototype: true, |
| 72 | + singleReturnOnly: false, |
| 73 | + classPropertiesAllowed: false, |
| 74 | + }, |
| 75 | + ], |
| 76 | + "no-restricted-imports": [ |
| 77 | + "error", |
| 78 | + { |
| 79 | + paths: [ |
| 80 | + { |
| 81 | + name: "aws-sdk", |
| 82 | + message: "Please use aws-sdk/{module} import instead", |
| 83 | + }, |
| 84 | + { |
| 85 | + name: ".", |
| 86 | + message: "Please use explicit import file", |
| 87 | + }, |
| 88 | + ], |
| 89 | + }, |
| 90 | + ], |
| 91 | + curly: ["error", "all"], |
| 92 | + }, |
| 93 | + root: true, |
| 94 | + env: { |
| 95 | + es6: true, |
| 96 | + node: true, |
| 97 | + browser: true, |
| 98 | + }, |
| 99 | + plugins: ["prefer-arrow", "import"], |
| 100 | + parserOptions: { |
| 101 | + ecmaVersion: 9, |
| 102 | + sourceType: "module", |
| 103 | + project: ["./tsconfig.eslint.json"], |
| 104 | + tsconfigRootDir: __dirname, |
| 105 | + }, |
| 106 | + overrides: [ |
| 107 | + { |
| 108 | + files: ["**/*.ts?(x)"], |
| 109 | + extends: [ |
| 110 | + "plugin:@typescript-eslint/recommended", |
| 111 | + "plugin:@typescript-eslint/recommended-requiring-type-checking", |
| 112 | + "plugin:prettier/recommended", |
| 113 | + ], |
| 114 | + parser: "@typescript-eslint/parser", |
| 115 | + parserOptions: { |
| 116 | + project: "tsconfig.eslint.json", |
| 117 | + }, |
| 118 | + rules: { |
| 119 | + "@typescript-eslint/prefer-optional-chain": "error", |
| 120 | + "no-shadow": "off", |
| 121 | + "@typescript-eslint/no-shadow": "error", |
| 122 | + "@typescript-eslint/prefer-nullish-coalescing": "error", |
| 123 | + "@typescript-eslint/strict-boolean-expressions": [ |
| 124 | + "error", |
| 125 | + { |
| 126 | + allowString: false, |
| 127 | + allowNumber: false, |
| 128 | + allowNullableObject: true, |
| 129 | + }, |
| 130 | + ], |
| 131 | + "@typescript-eslint/ban-ts-comment": [ |
| 132 | + "error", |
| 133 | + { |
| 134 | + "ts-ignore": "allow-with-description", |
| 135 | + minimumDescriptionLength: 10, |
| 136 | + }, |
| 137 | + ], |
| 138 | + "@typescript-eslint/explicit-function-return-type": 0, |
| 139 | + "@typescript-eslint/explicit-member-accessibility": 0, |
| 140 | + "@typescript-eslint/camelcase": 0, |
| 141 | + "@typescript-eslint/interface-name-prefix": 0, |
| 142 | + "@typescript-eslint/explicit-module-boundary-types": "error", |
| 143 | + "@typescript-eslint/no-explicit-any": "error", |
| 144 | + "@typescript-eslint/no-unused-vars": "error", |
| 145 | + "@typescript-eslint/ban-types": [ |
| 146 | + "error", |
| 147 | + { |
| 148 | + types: { |
| 149 | + FC: "Use `const MyComponent = (props: Props): JSX.Element` instead", |
| 150 | + SFC: "Use `const MyComponent = (props: Props): JSX.Element` instead", |
| 151 | + FunctionComponent: |
| 152 | + "Use `const MyComponent = (props: Props): JSX.Element` instead", |
| 153 | + "React.FC": |
| 154 | + "Use `const MyComponent = (props: Props): JSX.Element` instead", |
| 155 | + "React.SFC": |
| 156 | + "Use `const MyComponent = (props: Props): JSX.Element` instead", |
| 157 | + "React.FunctionComponent": |
| 158 | + "Use `const MyComponent = (props: Props): JSX.Element` instead", |
| 159 | + }, |
| 160 | + extendDefaults: true, |
| 161 | + }, |
| 162 | + ], |
| 163 | + "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error", |
| 164 | + "@typescript-eslint/no-unnecessary-condition": "error", |
| 165 | + "@typescript-eslint/no-unnecessary-type-arguments": "error", |
| 166 | + "@typescript-eslint/prefer-string-starts-ends-with": "error", |
| 167 | + "@typescript-eslint/switch-exhaustiveness-check": "error", |
| 168 | + "@typescript-eslint/restrict-template-expressions": [ |
| 169 | + "error", |
| 170 | + { |
| 171 | + allowNumber: true, |
| 172 | + allowBoolean: true, |
| 173 | + }, |
| 174 | + ], |
| 175 | + "@typescript-eslint/no-unsafe-enum-comparison": "warn", |
| 176 | + }, |
| 177 | + }, |
| 178 | + ], |
| 179 | +}; |
0 commit comments