Skip to content

Commit 13a3d4c

Browse files
Linting: StandardJS for src/, test/; Prettier for types/ (#2544)
* setup linting with eslint-config-standard, prettier * [autofix] npm run lint -- --fix with new setup * [manual] fix types/ directory errors * [manual] fix linting errors in test/ directory * [manual] fix single linting error in src/ * revert ts-expect-error comment change * error on .only in mocha tests * fix test description typo * move some short objects to single line * add and gitignore eslintcache * individually suppress ts any * set --max-warnings to 0 * extract matrices to constants * update ts-expect-error comments
1 parent ad847cc commit 13a3d4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4159
-3859
lines changed

.eslintrc.cjs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
node: true
6+
},
7+
extends: ['eslint:recommended'],
8+
parserOptions: {
9+
ecmaVersion: 12,
10+
sourceType: 'module'
11+
},
12+
ignorePatterns: ['*.generated.js'],
13+
rules: {},
14+
overrides: [
15+
{
16+
files: ['*.js', '*.cjs', '*.mjs'],
17+
extends: [
18+
'standard'
19+
]
20+
},
21+
{
22+
files: ['*.test.js'],
23+
plugins: ['mocha'],
24+
extends: [
25+
'standard',
26+
'plugin:mocha/recommended'
27+
],
28+
rules: {
29+
'mocha/no-skipped-tests': 'error',
30+
'mocha/no-exclusive-tests': 'error',
31+
'mocha/no-setup-in-describe': 'off',
32+
'mocha/no-identical-title': 'off' // TODO: Remove this
33+
}
34+
},
35+
{
36+
files: ['types/*.ts'],
37+
extends: [
38+
'plugin:@typescript-eslint/recommended',
39+
'plugin:prettier/recommended' // this should come last
40+
],
41+
rules: {
42+
'@typescript-eslint/no-unused-vars': [
43+
'error',
44+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' }
45+
]
46+
},
47+
plugins: ['@typescript-eslint'],
48+
parserOptions: {
49+
ecmaVersion: 12,
50+
sourceType: 'module',
51+
project: 'types/tsconfig.json'
52+
}
53+
}
54+
]
55+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ _site
99
node_modules
1010
.nyc_output
1111
/coverage
12+
.eslintcache
1213

1314
lib
1415
*.generated.js

.prettierrc.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
semi: false,
3+
singleQuote: true,
4+
}

0 commit comments

Comments
 (0)