Skip to content

Commit d93150b

Browse files
committed
Use eslint-define-config
1 parent 1bcb6bb commit d93150b

4 files changed

Lines changed: 194 additions & 189 deletions

File tree

.eslintrc.js

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
// @ts-check
2+
const { defineConfig } = require('eslint-define-config');
3+
4+
module.exports = defineConfig({
5+
ignorePatterns: ['.eslintrc.js'],
6+
env: {
7+
es6: true,
8+
jest: true,
9+
node: true
10+
},
11+
extends: [
12+
'eslint:recommended',
13+
'plugin:@typescript-eslint/recommended',
14+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
15+
'plugin:jsdoc/recommended',
16+
'plugin:prettier/recommended'
17+
],
18+
globals: {
19+
Atomics: 'readonly',
20+
SharedArrayBuffer: 'readonly'
21+
},
22+
parser: '@typescript-eslint/parser',
23+
parserOptions: {
24+
project: ['./tsconfig.lint.json'],
25+
warnOnUnsupportedTypeScriptVersion: false
26+
},
27+
plugins: ['@typescript-eslint', 'prettier', 'jsdoc', 'spellcheck', 'inclusive-language'],
28+
rules: {
29+
curly: ['error'],
30+
'linebreak-style': ['error', 'unix'],
31+
'no-case-declarations': 'warn',
32+
quotes: ['error', 'single', { avoidEscape: true }],
33+
semi: ['error', 'always'],
34+
35+
'@typescript-eslint/ban-ts-comment': 'off',
36+
'@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
37+
'@typescript-eslint/indent': ['error', 'tab', { SwitchCase: 1, ignoredNodes: ['MemberExpression'] }],
38+
'@typescript-eslint/interface-name-prefix': 'off',
39+
'@typescript-eslint/member-ordering': 'warn',
40+
'@typescript-eslint/no-explicit-any': 'off',
41+
'@typescript-eslint/no-inferrable-types': 'off',
42+
'@typescript-eslint/no-parameter-properties': 'off',
43+
'@typescript-eslint/no-unsafe-assignment': 'off',
44+
'@typescript-eslint/no-unused-vars': 'off',
45+
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
46+
'@typescript-eslint/prefer-optional-chain': 'warn',
47+
'@typescript-eslint/prefer-readonly': ['warn'],
48+
'@typescript-eslint/restrict-template-expressions': 'off',
49+
'@typescript-eslint/typedef': ['warn', { memberVariableDeclaration: true, variableDeclaration: true }],
50+
51+
'jsdoc/match-description': [
52+
'warn',
53+
{
54+
mainDescription: '/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us',
55+
matchDescription: '^[A-Z`].+(\\.|`.+`)$',
56+
contexts: ['any'],
57+
tags: {
58+
param: true,
59+
returns: true
60+
}
61+
}
62+
],
63+
'jsdoc/no-types': 'error',
64+
'jsdoc/require-jsdoc': [
65+
'warn',
66+
{
67+
contexts: [
68+
'ClassDeclaration',
69+
"ClassProperty:not([accessibility='private'])",
70+
'ExportNamedDeclaration:has(VariableDeclaration)',
71+
'FunctionExpression',
72+
"MethodDefinition:not([accessibility='private']) > FunctionExpression",
73+
'TSEnumDeclaration',
74+
'TSInterfaceDeclaration',
75+
'TSMethodSignature',
76+
// 'TSPropertySignature',
77+
'TSTypeAliasDeclaration'
78+
]
79+
}
80+
],
81+
'jsdoc/require-param-type': 'off',
82+
'jsdoc/require-returns-type': 'off',
83+
84+
'spellcheck/spell-checker': [
85+
'warn',
86+
{
87+
minLength: 3,
88+
skipWords: [
89+
'ast',
90+
'backtick',
91+
'blockcode',
92+
'codemirror',
93+
'coffeescript',
94+
'colno',
95+
'doctype',
96+
'endregion',
97+
'eos',
98+
'fallthrough',
99+
'filenames',
100+
'frameset',
101+
'func',
102+
'href',
103+
'javascript',
104+
'jsdoc',
105+
'junit',
106+
'len',
107+
'lex',
108+
'lex',
109+
'lf',
110+
'lineno',
111+
'loc',
112+
'multiline',
113+
'multilines',
114+
'num',
115+
'outdent',
116+
'parens',
117+
'pipeless',
118+
'plist',
119+
'pragma',
120+
'prepend',
121+
'readdir',
122+
'readonly',
123+
'rvalue',
124+
'str',
125+
'tok',
126+
'typeof',
127+
'unescaped',
128+
'unformatted',
129+
'utf',
130+
'utf8',
131+
'vscode',
132+
'vue',
133+
'whitespace',
134+
'xml'
135+
]
136+
}
137+
],
138+
139+
'inclusive-language/use-inclusive-words': [
140+
'warn',
141+
{
142+
allowedTerms: [
143+
{
144+
term: '/master',
145+
allowPartialMatches: true
146+
}
147+
],
148+
words: [
149+
{
150+
word: 'guys',
151+
suggestions: ['folks']
152+
}
153+
]
154+
}
155+
]
156+
},
157+
settings: {
158+
jsdoc: {
159+
mode: 'typescript'
160+
}
161+
}
162+
});

.eslintrc.json

Lines changed: 0 additions & 158 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"benchmark": "~2.1.4",
4444
"eslint": "~7.22.0",
4545
"eslint-config-prettier": "~8.1.0",
46+
"eslint-define-config": "~1.0.1",
4647
"eslint-plugin-inclusive-language": "~2.1.1",
4748
"eslint-plugin-jsdoc": "~32.3.0",
4849
"eslint-plugin-prettier": "~3.3.1",

0 commit comments

Comments
 (0)