|
| 1 | +{ |
| 2 | + "$schema": "https://json.schemastore.org/eslintrc", |
| 3 | + "root": true, |
| 4 | + "ignorePatterns": ["projects/**/*"], |
| 5 | + "overrides": [ |
| 6 | + { |
| 7 | + "files": ["src/**/*.ts"], |
| 8 | + "parserOptions": { |
| 9 | + "project": ["tsconfig.json"], |
| 10 | + "createDefaultProgram": true |
| 11 | + }, |
| 12 | + "extends": [ |
| 13 | + "eslint:recommended", |
| 14 | + "plugin:import/recommended", |
| 15 | + "plugin:import/typescript", |
| 16 | + "plugin:rxjs/recommended", |
| 17 | + "plugin:@typescript-eslint/recommended", |
| 18 | + "plugin:@angular-eslint/recommended", |
| 19 | + "plugin:@angular-eslint/template/process-inline-templates", |
| 20 | + "prettier" |
| 21 | + ], |
| 22 | + "plugins": ["jsdoc", "rxjs-angular", "unicorn"], |
| 23 | + "rules": { |
| 24 | + // Component selectors should follow given naming rules. |
| 25 | + // @see http://codelyzer.com/rules/component-selector/ |
| 26 | + "@angular-eslint/component-selector": [ |
| 27 | + "error", |
| 28 | + { |
| 29 | + "type": "element", |
| 30 | + "prefix": "pro", |
| 31 | + "style": "kebab-case" |
| 32 | + } |
| 33 | + ], |
| 34 | + // Directive selectors should follow given naming rules. |
| 35 | + // @see http://codelyzer.com/rules/directive-selector/ |
| 36 | + "@angular-eslint/directive-selector": [ |
| 37 | + "error", |
| 38 | + { |
| 39 | + "type": "attribute", |
| 40 | + "prefix": "pro", |
| 41 | + "style": "camelCase" |
| 42 | + } |
| 43 | + ], |
| 44 | + // Disallows usage of the host metadata property. |
| 45 | + // @see http://codelyzer.com/rules/no-host-metadata-property/ |
| 46 | + "@angular-eslint/no-host-metadata-property": [ |
| 47 | + "error", |
| 48 | + { "allowStatic": true } |
| 49 | + ], |
| 50 | + // Prefer to declare @Output as readonly since they are not supposed |
| 51 | + // to be reassigned. |
| 52 | + // @see http://codelyzer.com/rules/prefer-output-readonly/ |
| 53 | + "@angular-eslint/prefer-output-readonly": ["error"], |
| 54 | + // Enforce use of component selector rules. |
| 55 | + // @see http://codelyzer.com/rules/component-selector/ |
| 56 | + "@angular-eslint/use-component-selector": ["error"], |
| 57 | + // Disallows using ViewEncapsulation.None. |
| 58 | + // @see http://codelyzer.com/rules/use-component-view-encapsulation/ |
| 59 | + "@angular-eslint/use-component-view-encapsulation": ["error"], |
| 60 | + // Ensure that components implement life cycle interfaces if they use |
| 61 | + // them. |
| 62 | + // @see http://codelyzer.com/rules/use-life-cycle-interface/ |
| 63 | + "@angular-eslint/use-lifecycle-interface": ["error"], |
| 64 | + // Require consistently using either T[] or Array<T> for arrays. |
| 65 | + // @see https://typescript-eslint.io/rules/array-type/ |
| 66 | + "@typescript-eslint/array-type": [ |
| 67 | + "error", |
| 68 | + { "default": "array-simple" } |
| 69 | + ], |
| 70 | + // Enforce consistent usage of type assertions. |
| 71 | + // @see https://typescript-eslint.io/rules/consistent-type-assertions/ |
| 72 | + "@typescript-eslint/consistent-type-assertions": [ |
| 73 | + "error", |
| 74 | + { |
| 75 | + "assertionStyle": "as", |
| 76 | + "objectLiteralTypeAssertions": "never" |
| 77 | + } |
| 78 | + ], |
| 79 | + // Enforce type definitions to consistently use either interface or type. |
| 80 | + // @see https://typescript-eslint.io/rules/consistent-type-definitions/ |
| 81 | + "@typescript-eslint/consistent-type-definitions": "error", |
| 82 | + // Require explicit return types on functions and class methods. |
| 83 | + // @see https://typescript-eslint.io/rules/explicit-function-return-type/ |
| 84 | + "@typescript-eslint/explicit-function-return-type": [ |
| 85 | + "error", |
| 86 | + { "allowExpressions": true } |
| 87 | + ], |
| 88 | + // Require explicit accessibility modifiers on class properties and methods. |
| 89 | + // @see https://typescript-eslint.io/rules/explicit-member-accessibility/ |
| 90 | + "@typescript-eslint/explicit-member-accessibility": [ |
| 91 | + "error", |
| 92 | + { "accessibility": "explicit" } |
| 93 | + ], |
| 94 | + // Require explicit return and argument types on exported functions' and |
| 95 | + // classes' public class methods. |
| 96 | + // @see https://typescript-eslint.io/rules/explicit-module-boundary-types/ |
| 97 | + "@typescript-eslint/explicit-module-boundary-types": "error", |
| 98 | + // Require a consistent member declaration order. |
| 99 | + // @see https://typescript-eslint.io/rules/member-ordering/ |
| 100 | + "@typescript-eslint/member-ordering": [ |
| 101 | + "error", |
| 102 | + { |
| 103 | + "default": [ |
| 104 | + "constructor", |
| 105 | + "static-field", |
| 106 | + "instance-field", |
| 107 | + "static-method", |
| 108 | + "instance-method" |
| 109 | + ] |
| 110 | + } |
| 111 | + ], |
| 112 | + // Enforce naming conventions for everything across a codebase. |
| 113 | + // @see https://typescript-eslint.io/rules/naming-convention/ |
| 114 | + "@typescript-eslint/naming-convention": [ |
| 115 | + "error", |
| 116 | + { |
| 117 | + "selector": "classProperty", |
| 118 | + "format": ["PascalCase", "camelCase"], |
| 119 | + "modifiers": ["public"] |
| 120 | + }, |
| 121 | + { |
| 122 | + "selector": "function", |
| 123 | + "format": ["camelCase"] |
| 124 | + }, |
| 125 | + { |
| 126 | + "selector": "interface", |
| 127 | + "format": ["PascalCase"], |
| 128 | + "custom": { |
| 129 | + "regex": "^I[A-Z]", |
| 130 | + "match": false |
| 131 | + } |
| 132 | + }, |
| 133 | + { |
| 134 | + "selector": "enumMember", |
| 135 | + "format": ["UPPER_CASE"] |
| 136 | + } |
| 137 | + ], |
| 138 | + // Disallow empty functions. |
| 139 | + // @see https://typescript-eslint.io/rules/no-empty-function/ |
| 140 | + "@typescript-eslint/no-empty-function": "error", |
| 141 | + // Disallow the declaration of empty interfaces. |
| 142 | + // @see https://typescript-eslint.io/rules/no-empty-interface/ |
| 143 | + "@typescript-eslint/no-empty-interface": "off", |
| 144 | + // Disallow the any type. |
| 145 | + // @see https://typescript-eslint.io/rules/no-explicit-any/ |
| 146 | + "@typescript-eslint/no-explicit-any": "error", |
| 147 | + // Disallow TypeScript namespaces. |
| 148 | + // @see https://typescript-eslint.io/rules/no-namespace/ |
| 149 | + "@typescript-eslint/no-namespace": [ |
| 150 | + "error", |
| 151 | + { "allowDeclarations": true } |
| 152 | + ], |
| 153 | + // Disallow unused expressions. |
| 154 | + // @see https://typescript-eslint.io/rules/no-unused-expressions/ |
| 155 | + "@typescript-eslint/no-unused-expressions": "error", |
| 156 | + // Disallow unused variables. |
| 157 | + // @see https://typescript-eslint.io/rules/no-unused-vars/ |
| 158 | + "@typescript-eslint/no-unused-vars": [ |
| 159 | + "error", |
| 160 | + { |
| 161 | + "argsIgnorePattern": "^_", |
| 162 | + "ignoreRestSiblings": true, |
| 163 | + "varsIgnorePattern": "^_" |
| 164 | + } |
| 165 | + ], |
| 166 | + // Enforce the use of for-of loop over the standard for loop where |
| 167 | + // possible. |
| 168 | + // @see https://typescript-eslint.io/rules/prefer-for-of/ |
| 169 | + "@typescript-eslint/prefer-for-of": ["warn"], |
| 170 | + // Enforce using function types instead of interfaces with call |
| 171 | + // signatures. |
| 172 | + // @see https://typescript-eslint.io/rules/prefer-function-type/ |
| 173 | + "@typescript-eslint/prefer-function-type": ["warn"], |
| 174 | + // Require private members to be marked as readonly if they're never |
| 175 | + // modified outside of the constructor. |
| 176 | + // @see https://typescript-eslint.io/rules/prefer-readonly/ |
| 177 | + "@typescript-eslint/prefer-readonly": "error", |
| 178 | + // Disallow two overloads that could be unified into one with a union |
| 179 | + // or an optional/rest parameter. |
| 180 | + // @see https://typescript-eslint.io/rules/unified-signatures/ |
| 181 | + "@typescript-eslint/unified-signatures": "warn", |
| 182 | + // Require the use of === and !== |
| 183 | + // @see https://eslint.org/docs/latest/rules/eqeqeq |
| 184 | + "eqeqeq": ["error"], |
| 185 | + // Require for-in loops to include an if statement |
| 186 | + // @see https://eslint.org/docs/latest/rules/guard-for-in |
| 187 | + "guard-for-in": ["error"], |
| 188 | + // Prohibit default exports. |
| 189 | + // @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md |
| 190 | + "import/no-default-export": ["error"], |
| 191 | + // Reports use of a deprecated name, as indicated by a JSDoc block |
| 192 | + // with a @deprecated tag or TomDoc Deprecated: comment. |
| 193 | + // @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md |
| 194 | + "import/no-deprecated": "off", |
| 195 | + // Ensures an imported module can be resolved to a module on the local |
| 196 | + // filesystem. |
| 197 | + // @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md |
| 198 | + "import/no-unresolved": "off", |
| 199 | + // Reports invalid alignment of JSDoc block asterisks. |
| 200 | + // @see https://github.com/gajus/eslint-plugin-jsdoc/blob/master/.README/rules/check-alignment.md |
| 201 | + "jsdoc/check-alignment": ["error"], |
| 202 | + // Reports invalid padding inside JSDoc blocks. |
| 203 | + // @see https://github.com/gajus/eslint-plugin-jsdoc/blob/master/.README/rules/check-indentation.md |
| 204 | + "jsdoc/check-indentation": ["error"], |
| 205 | + // Disallow bitwise operators |
| 206 | + // @see https://eslint.org/docs/latest/rules/no-bitwise |
| 207 | + "no-bitwise": ["error"], |
| 208 | + // Disallow the use of arguments.caller or arguments.callee |
| 209 | + // @see https://eslint.org/docs/latest/rules/no-caller |
| 210 | + "no-caller": ["error"], |
| 211 | + // Disallow the use of console |
| 212 | + // @see https://eslint.org/docs/latest/rules/no-console |
| 213 | + "no-console": ["error", { "allow": ["warn", "error"] }], |
| 214 | + // Disallow duplicate module imports |
| 215 | + // @see https://eslint.org/docs/latest/rules/no-duplicate-imports |
| 216 | + "no-duplicate-imports": ["error"], |
| 217 | + // Disallow empty block statements |
| 218 | + // @see https://eslint.org/docs/latest/rules/no-empty |
| 219 | + "no-empty": "error", |
| 220 | + // Disallow the use of eval() |
| 221 | + // @see https://eslint.org/docs/latest/rules/no-eval |
| 222 | + "no-eval": ["error"], |
| 223 | + // Disallow new operators with the String, Number, and Boolean objects |
| 224 | + // @see https://eslint.org/docs/latest/rules/no-new-wrappers |
| 225 | + "no-new-wrappers": ["error"], |
| 226 | + // Disallow throwing literals as exceptions |
| 227 | + // @see https://eslint.org/docs/latest/rules/no-throw-literal |
| 228 | + "no-throw-literal": ["error"], |
| 229 | + // Require let or const instead of var |
| 230 | + // @see https://eslint.org/docs/latest/rules/no-var |
| 231 | + "no-var": ["error"], |
| 232 | + // Require or disallow method and property shorthand syntax for object |
| 233 | + // literals |
| 234 | + // @see https://eslint.org/docs/latest/rules/object-shorthand |
| 235 | + "object-shorthand": ["error"], |
| 236 | + // Enforce variables to be declared either together or separately in |
| 237 | + // functions |
| 238 | + // @see https://eslint.org/docs/latest/rules/one-var |
| 239 | + "one-var": ["error", "never"], |
| 240 | + // Require using arrow functions for callbacks |
| 241 | + // @see https://eslint.org/docs/latest/rules/prefer-arrow-callback |
| 242 | + "prefer-arrow/prefer-arrow-functions": "off", |
| 243 | + // Require const declarations for variables that are never reassigned |
| 244 | + // after declared |
| 245 | + // @see https://eslint.org/docs/latest/rules/prefer-const |
| 246 | + "prefer-const": ["error"], |
| 247 | + // Enforce the consistent use of the radix argument when using |
| 248 | + // parseInt() |
| 249 | + // @see https://eslint.org/docs/latest/rules/radix |
| 250 | + "radix": ["error"], |
| 251 | + // This rule effects failures if subscribe is called within a component |
| 252 | + // and the takeUntil-destroyed pattern is not used. |
| 253 | + // @see https://github.com/cartant/eslint-plugin-rxjs-angular/blob/main/docs/rules/prefer-takeuntil.md |
| 254 | + "rxjs-angular/prefer-takeuntil": [ |
| 255 | + "error", |
| 256 | + { "alias": ["untilDestroyed"] } |
| 257 | + ], |
| 258 | + // This rule effects failures if async functions are passed to |
| 259 | + // subscribe. |
| 260 | + // @see https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-async-subscribe.md |
| 261 | + "rxjs/no-async-subscribe": "off", |
| 262 | + // This rule prevents the public or protected subjects. Developers |
| 263 | + // should instead expose observables via the subjects' toObservable |
| 264 | + // method. |
| 265 | + // @see https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-exposed-subjects.md |
| 266 | + "rxjs/no-exposed-subjects": ["error"], |
| 267 | + // This rule prevents the use of Finnish notation. |
| 268 | + // @see https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-finnish.md |
| 269 | + "rxjs/no-finnish": ["error"], |
| 270 | + // This rule effects failures if the buffer size of a replay buffer is |
| 271 | + // not explicitly specified. |
| 272 | + // @see https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-ignored-replay-buffer.md |
| 273 | + "rxjs/no-ignored-replay-buffer": ["error"], |
| 274 | + // This rule effects failures if the shareReplay operator is used. |
| 275 | + // @see https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-sharereplay.md |
| 276 | + "rxjs/no-sharereplay": "off", |
| 277 | + // This rule effects failures if the tap operator is used. |
| 278 | + // @see https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-tap.md |
| 279 | + "rxjs/no-tap": ["error"], |
| 280 | + // This rule effects failures whenever takeUntil is used in observable |
| 281 | + // compositions that can leak subscriptions. |
| 282 | + // @see https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-unsafe-takeuntil.md |
| 283 | + "rxjs/no-unsafe-takeuntil": ["error", { "alias": ["untilDestroyed"] }], |
| 284 | + // Enforce consistent spacing after the // or /* in a comment |
| 285 | + // @see https://eslint.org/docs/latest/rules/spaced-comment |
| 286 | + "spaced-comment": [ |
| 287 | + "error", |
| 288 | + "always", |
| 289 | + { "block": { "balanced": true } } |
| 290 | + ], |
| 291 | + // Enforces all linted files to have their names in a certain case |
| 292 | + // style and lowercase file extension. |
| 293 | + // @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md |
| 294 | + "unicorn/filename-case": ["error", { "case": "kebabCase" }] |
| 295 | + } |
| 296 | + }, |
| 297 | + { |
| 298 | + "files": ["src/**/*.html"], |
| 299 | + "parser": "@angular-eslint/template-parser", |
| 300 | + "extends": ["plugin:@angular-eslint/template/recommended"], |
| 301 | + "rules": {} |
| 302 | + } |
| 303 | + ] |
| 304 | +} |
0 commit comments