|
| 1 | +// @ts-check |
| 2 | +const { defineConfig } = require('eslint-define-config'); |
| 3 | + |
| 4 | +module.exports = defineConfig({ |
| 5 | + env: { |
| 6 | + es6: true, |
| 7 | + node: true |
| 8 | + }, |
| 9 | + extends: [ |
| 10 | + 'eslint:recommended', |
| 11 | + 'plugin:@typescript-eslint/recommended', |
| 12 | + 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
| 13 | + 'plugin:jsdoc/recommended', |
| 14 | + 'plugin:prettier/recommended' |
| 15 | + ], |
| 16 | + parser: '@typescript-eslint/parser', |
| 17 | + parserOptions: { |
| 18 | + project: ['./tsconfig.lint.json'], |
| 19 | + warnOnUnsupportedTypeScriptVersion: false |
| 20 | + }, |
| 21 | + plugins: ['@typescript-eslint', 'prettier', 'jsdoc', 'spellcheck', 'inclusive-language'], |
| 22 | + rules: { |
| 23 | + curly: ['error'], |
| 24 | + 'linebreak-style': ['error', 'unix'], |
| 25 | + 'no-case-declarations': 'warn', |
| 26 | + quotes: ['error', 'single', { avoidEscape: true }], |
| 27 | + semi: ['error', 'always'], |
| 28 | + |
| 29 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 30 | + '@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }], |
| 31 | + '@typescript-eslint/indent': ['error', 2, { SwitchCase: 1, ignoredNodes: ['MemberExpression'] }], |
| 32 | + '@typescript-eslint/interface-name-prefix': 'off', |
| 33 | + '@typescript-eslint/member-ordering': 'warn', |
| 34 | + '@typescript-eslint/no-explicit-any': 'off', |
| 35 | + '@typescript-eslint/no-inferrable-types': 'off', |
| 36 | + '@typescript-eslint/no-parameter-properties': 'off', |
| 37 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
| 38 | + '@typescript-eslint/no-unused-vars': 'off', |
| 39 | + '@typescript-eslint/prefer-nullish-coalescing': 'warn', |
| 40 | + '@typescript-eslint/prefer-optional-chain': 'warn', |
| 41 | + '@typescript-eslint/prefer-readonly': ['warn'], |
| 42 | + '@typescript-eslint/restrict-template-expressions': 'off', |
| 43 | + '@typescript-eslint/typedef': ['warn', { memberVariableDeclaration: true, variableDeclaration: true }], |
| 44 | + |
| 45 | + 'jsdoc/match-description': [ |
| 46 | + 'warn', |
| 47 | + { |
| 48 | + mainDescription: '/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us', |
| 49 | + matchDescription: '^[A-Z`].+(\\.|`.+`)$', |
| 50 | + contexts: ['any'], |
| 51 | + tags: { |
| 52 | + param: true, |
| 53 | + returns: true |
| 54 | + } |
| 55 | + } |
| 56 | + ], |
| 57 | + 'jsdoc/no-types': 'error', |
| 58 | + 'jsdoc/require-jsdoc': [ |
| 59 | + 'warn', |
| 60 | + { |
| 61 | + contexts: [ |
| 62 | + 'ClassDeclaration', |
| 63 | + "ClassProperty:not([accessibility='private'])", |
| 64 | + 'ExportNamedDeclaration:has(VariableDeclaration)', |
| 65 | + 'FunctionExpression', |
| 66 | + "MethodDefinition:not([accessibility='private']) > FunctionExpression", |
| 67 | + 'TSEnumDeclaration', |
| 68 | + 'TSInterfaceDeclaration', |
| 69 | + 'TSMethodSignature', |
| 70 | + // 'TSPropertySignature', |
| 71 | + 'TSTypeAliasDeclaration' |
| 72 | + ] |
| 73 | + } |
| 74 | + ], |
| 75 | + 'jsdoc/require-param-type': 'off', |
| 76 | + 'jsdoc/require-returns-type': 'off', |
| 77 | + |
| 78 | + 'spellcheck/spell-checker': [ |
| 79 | + 'warn', |
| 80 | + { |
| 81 | + minLength: 3, |
| 82 | + skipWords: ['backtick', 'backticks', 'ecma'] |
| 83 | + } |
| 84 | + ], |
| 85 | + |
| 86 | + 'inclusive-language/use-inclusive-words': [ |
| 87 | + 'warn', |
| 88 | + { |
| 89 | + allowedTerms: [ |
| 90 | + { |
| 91 | + term: '/master', |
| 92 | + allowPartialMatches: true |
| 93 | + } |
| 94 | + ], |
| 95 | + words: [ |
| 96 | + { |
| 97 | + word: 'guys', |
| 98 | + suggestions: ['folks'] |
| 99 | + } |
| 100 | + ] |
| 101 | + } |
| 102 | + ] |
| 103 | + }, |
| 104 | + settings: { |
| 105 | + jsdoc: { |
| 106 | + mode: 'typescript' |
| 107 | + } |
| 108 | + } |
| 109 | +}); |
0 commit comments