|
1 | | -{ |
2 | | - "root": true, |
3 | | - "parser": "@typescript-eslint/parser", |
4 | | - "extends": [ |
5 | | - "eslint:recommended", |
6 | | - "plugin:@typescript-eslint/recommended", |
7 | | - "plugin:promise/recommended" |
| 1 | +const js = require("@eslint/js"); |
| 2 | +const tsParser = require("@typescript-eslint/parser"); |
| 3 | +const tsPlugin = require("@typescript-eslint/eslint-plugin"); |
| 4 | +const promisePlugin = require("eslint-plugin-promise"); |
| 5 | +const globals = require('globals'); |
| 6 | + |
| 7 | +module.exports = { |
| 8 | + files: [ |
| 9 | + "**/*.ts", |
| 10 | + "**/*.tsx" |
8 | 11 | ], |
9 | | - "parserOptions": { |
10 | | - "ecmaVersion": 6, |
11 | | - "sourceType": "module" |
12 | | - }, |
13 | | - "plugins": [ |
14 | | - "@typescript-eslint", |
15 | | - "promise" |
16 | | - ], |
17 | | - "ignorePatterns": [ |
18 | | - "**/{node_modules,lib,bin}" |
| 12 | + ignores: [ |
| 13 | + // default ignores: ["**/node_modules/", ".git/"] |
| 14 | + "**/lib/", |
| 15 | + "**/out/" |
19 | 16 | ], |
20 | | - "rules": { |
| 17 | + languageOptions: { |
| 18 | + parser: tsParser, |
| 19 | + parserOptions: { |
| 20 | + ecmaVersion: 6, |
| 21 | + sourceType: 'module' |
| 22 | + }, |
| 23 | + }, |
| 24 | + plugins: { |
| 25 | + "@typescript-eslint": tsPlugin, |
| 26 | + "promise": promisePlugin |
| 27 | + }, |
| 28 | + rules: { |
| 29 | + ...js.configs.recommended.rules, |
| 30 | + ...promisePlugin.configs['flat/recommended'].rules, |
| 31 | + ...tsPlugin.configs.recommended.rules, |
21 | 32 | // List of [ESLint rules](https://eslint.org/docs/rules/) |
| 33 | + "no-undef": "off", // TypeScript checks this |
22 | 34 | "arrow-parens": ["off", "as-needed"], // do not force arrow function parentheses |
23 | 35 | "constructor-super": "error", // checks the correct use of super() in sub-classes |
24 | 36 | "dot-notation": "error", // obj.a instead of obj['a'] when possible |
|
32 | 44 | "no-eval": "error", // eval is considered unsafe |
33 | 45 | "no-inner-declarations": "off", // we need to have 'namespace' functions when using TS 'export =' |
34 | 46 | "no-labels": "error", // GOTO is only used in BASIC ;) |
35 | | - "no-multiple-empty-lines": ["error", {"max": 1}], // two or more empty lines need to be fused to one |
| 47 | + "no-multiple-empty-lines": ["error", { "max": 1 }], // two or more empty lines need to be fused to one |
36 | 48 | "no-new-wrappers": "error", // there is no reason to wrap primitve values |
37 | 49 | "no-throw-literal": "error", // only throw Error but no objects {} |
38 | 50 | "no-trailing-spaces": "error", // trim end of lines |
|
51 | 63 | "@typescript-eslint/array-type": ["error", { // string[] instead of Array<string> |
52 | 64 | "default": "array-simple" |
53 | 65 | }], |
54 | | - "@typescript-eslint/ban-types": "error", // bans types like String in favor of string |
55 | | - "@typescript-eslint/indent": "error", // consistent indentation |
| 66 | + "@typescript-eslint/no-wrapper-object-types": "error", // bans types like String in favor of string |
| 67 | + |
| 68 | + // FIXME now from @stylistic/indent plugin : "@typescript-eslint/indent": "error", // consistent indentation |
56 | 69 | "@typescript-eslint/no-explicit-any": "error", // don't use :any type |
57 | 70 | "@typescript-eslint/no-misused-new": "error", // no constructors for interfaces or new for classes |
58 | 71 | "@typescript-eslint/no-namespace": "off", // disallow the use of custom TypeScript modules and namespaces |
59 | 72 | "@typescript-eslint/no-non-null-assertion": "off", // allow ! operator |
60 | | - "@typescript-eslint/no-parameter-properties": "error", // no property definitions in class constructors |
| 73 | + "@typescript-eslint/parameter-properties": "error", // no property definitions in class constructors |
61 | 74 | "@typescript-eslint/no-unused-vars": ["error", { // disallow Unused Variables |
62 | 75 | "argsIgnorePattern": "^_" |
63 | 76 | }], |
64 | 77 | "@typescript-eslint/no-var-requires": "error", // use import instead of require |
65 | 78 | "@typescript-eslint/prefer-for-of": "error", // prefer for-of loop over arrays |
66 | 79 | "@typescript-eslint/prefer-namespace-keyword": "error", // prefer namespace over module in TypeScript |
67 | 80 | "@typescript-eslint/triple-slash-reference": "error", // ban /// <reference />, prefer imports |
68 | | - "@typescript-eslint/type-annotation-spacing": "error", // consistent space around colon ':' |
| 81 | + // FIXME now from @stylistic/indent plugin : "@typescript-eslint/type-annotation-spacing": "error", // consistent space around colon ':' |
69 | 82 | "@typescript-eslint/consistent-type-imports": "error" |
70 | 83 | } |
71 | 84 | } |
| 85 | + ; |
0 commit comments