|
1 | 1 | import { createConfig, getFilesGlobs } from "../utils/create-config";
|
2 | 2 | import type { OptionsFiles } from "../types";
|
| 3 | +import { Linter } from "eslint"; |
| 4 | + |
| 5 | +export const bestPracticesRules: Partial<Linter.RulesRecord> = { |
| 6 | + // Disallow non-null assertions using the ! postfix operator. |
| 7 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md |
| 8 | + "no-return-await": "off", |
| 9 | + |
| 10 | + // Disallow calling a value with type any. |
| 11 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md |
| 12 | + "no-unused-expressions": "off", |
| 13 | + |
| 14 | + // Disallow type assertions that do not change the type of expression. |
| 15 | + // Disable the "no-throw-literal" rule, as it can report incorrect errors on TypeScript code |
| 16 | + "no-throw-literal": "off", |
| 17 | + |
| 18 | + // Disallow empty exports that don't change anything in a module file. |
| 19 | + // Breaks @typescript-eslint/parser |
| 20 | + strict: "off", |
| 21 | + |
| 22 | + // Disable the "dot-notation" rule, as it can report incorrect errors on TypeScript code |
| 23 | + "dot-notation": "off", |
| 24 | + |
| 25 | + // Require explicit return and argument types on exported functions' and classes' public class methods. |
| 26 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md |
| 27 | + "no-empty-function": "off", |
| 28 | + |
| 29 | + // Disallow using to delete operator on computed key expressions. |
| 30 | + // Disable the "no-implied-eval" and "no-new-func" rule, as it can report incorrect errors on TypeScript code |
| 31 | + "no-implied-eval": "off", |
| 32 | + "no-new-func": "off", |
| 33 | + |
| 34 | + // Disallow extra non-null assertions. |
| 35 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md |
| 36 | + "no-loop-func": "off", |
| 37 | + |
| 38 | + // Disallow void type outside of generic or return types. |
| 39 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md |
| 40 | + "no-magic-numbers": "off", |
| 41 | + |
| 42 | + // Disallow non-null assertions after an optional chain expression. |
| 43 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md |
| 44 | + "no-redeclare": "off", |
| 45 | +}; |
3 | 46 |
|
4 | 47 | export default createConfig<OptionsFiles>("all", async (config, oFiles) => {
|
5 | 48 | const { files = oFiles } = config;
|
@@ -456,47 +499,7 @@ export default createConfig<OptionsFiles>("all", async (config, oFiles) => {
|
456 | 499 | {
|
457 | 500 | name: "anolilab/best-practices/ts-rules",
|
458 | 501 | files: getFilesGlobs("ts"),
|
459 |
| - rules: { |
460 |
| - // Disallow non-null assertions using the ! postfix operator. |
461 |
| - // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md |
462 |
| - "no-return-await": "off", |
463 |
| - |
464 |
| - // Disallow calling a value with type any. |
465 |
| - // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md |
466 |
| - "no-unused-expressions": "off", |
467 |
| - |
468 |
| - // Disallow type assertions that do not change the type of expression. |
469 |
| - // Disable the "no-throw-literal" rule, as it can report incorrect errors on TypeScript code |
470 |
| - "no-throw-literal": "off", |
471 |
| - |
472 |
| - // Disallow empty exports that don't change anything in a module file. |
473 |
| - // Breaks @typescript-eslint/parser |
474 |
| - strict: "off", |
475 |
| - |
476 |
| - // Disable the "dot-notation" rule, as it can report incorrect errors on TypeScript code |
477 |
| - "dot-notation": "off", |
478 |
| - |
479 |
| - // Require explicit return and argument types on exported functions' and classes' public class methods. |
480 |
| - // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md |
481 |
| - "no-empty-function": "off", |
482 |
| - |
483 |
| - // Disallow using to delete operator on computed key expressions. |
484 |
| - // Disable the "no-implied-eval" and "no-new-func" rule, as it can report incorrect errors on TypeScript code |
485 |
| - "no-implied-eval": "off", |
486 |
| - "no-new-func": "off", |
487 |
| - |
488 |
| - // Disallow extra non-null assertions. |
489 |
| - // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md |
490 |
| - "no-loop-func": "off", |
491 |
| - |
492 |
| - // Disallow void type outside of generic or return types. |
493 |
| - // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md |
494 |
| - "no-magic-numbers": "off", |
495 |
| - |
496 |
| - // Disallow non-null assertions after an optional chain expression. |
497 |
| - // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md |
498 |
| - "no-redeclare": "off", |
499 |
| - }, |
| 502 | + rules: bestPracticesRules, |
500 | 503 | },
|
501 | 504 | ];
|
502 | 505 | });
|
0 commit comments