Skip to content

Commit fc7e68a

Browse files
committed
fix: apply eslint to the whole project
1 parent edf059c commit fc7e68a

File tree

5 files changed

+39
-33
lines changed

5 files changed

+39
-33
lines changed

Diff for: eslint.config.mjs

+37-31
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,43 @@ import path from 'node:path';
55

66
const __dirname = path.resolve();
77

8-
export default tseslint.config(js.configs.recommended, ...tseslint.configs.recommended, {
9-
files: ['**/*.ts'],
10-
ignores: ['./public/**/*', 'release.config.js'],
11-
languageOptions: {
12-
ecmaVersion: 2022,
13-
sourceType: 'module',
14-
parser: tseslint.parser,
15-
parserOptions: {
16-
project: ['./tsconfig.json', './spec/tsconfig.json'],
17-
tsconfigRootDir: __dirname,
8+
export default tseslint.config(
9+
js.configs.recommended,
10+
...tseslint.configs.recommended,
11+
{
12+
files: ['**/*.ts'],
13+
languageOptions: {
14+
ecmaVersion: 2022,
15+
sourceType: 'module',
16+
parser: tseslint.parser,
17+
parserOptions: {
18+
project: ['./tsconfig.json', './spec/tsconfig.json'],
19+
tsconfigRootDir: __dirname,
20+
},
21+
globals: {
22+
...globals.node,
23+
Parse: 'readonly',
24+
},
1825
},
19-
globals: {
20-
...globals.node,
21-
Parse: 'readonly',
26+
rules: {
27+
'@typescript-eslint/explicit-function-return-type': 'off',
28+
'@typescript-eslint/no-explicit-any': 'warn',
29+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
30+
indent: ['error', 2, { SwitchCase: 1 }],
31+
'linebreak-style': ['error', 'unix'],
32+
'no-trailing-spaces': 'error',
33+
'eol-last': 'error',
34+
'space-in-parens': ['error', 'never'],
35+
'no-multiple-empty-lines': 'warn',
36+
'prefer-const': 'error',
37+
'space-infix-ops': 'error',
38+
'no-useless-escape': 'off',
39+
'require-atomic-updates': 'off',
40+
'no-var': 'warn',
41+
'no-await-in-loop': 'warn',
2242
},
2343
},
24-
rules: {
25-
'@typescript-eslint/explicit-function-return-type': 'off',
26-
'@typescript-eslint/no-explicit-any': 'warn',
27-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
28-
indent: ['error', 2, { SwitchCase: 1 }],
29-
'linebreak-style': ['error', 'unix'],
30-
'no-trailing-spaces': 'error',
31-
'eol-last': 'error',
32-
'space-in-parens': ['error', 'never'],
33-
'no-multiple-empty-lines': 'warn',
34-
'prefer-const': 'error',
35-
'space-infix-ops': 'error',
36-
'no-useless-escape': 'off',
37-
'require-atomic-updates': 'off',
38-
'no-var': 'warn',
39-
'no-await-in-loop': 'warn',
40-
},
41-
});
44+
{
45+
ignores: ['public/**/*', 'release.config.js'],
46+
}
47+
);

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"main": "dist/index.js",
1111
"scripts": {
1212
"coverage": "nyc --reporter=html --reporter=text npm test",
13-
"lint": "eslint --cache ./cloud && eslint --cache index.ts && eslint --cache ./spec",
14-
"lint-fix": "eslint --cache --fix ./cloud && eslint --cache --fix index.ts && eslint --cache --fix ./spec",
13+
"lint": "eslint --cache .",
14+
"lint-fix": "eslint --cache --fix .",
1515
"prettier": "prettier --write '{cloud,spec}/{**/*,*}.{ts,js,mjs,cjs}' index.ts",
1616
"start": "node dist/index.js",
1717
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=7.0.1} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} mongodb-runner start -t ${MONGODB_TOPOLOGY} --version ${MONGODB_VERSION} -- --port 27017",

Diff for: spec/Tests.spec.js renamed to spec/Tests.spec.ts

File renamed without changes.

Diff for: spec/helper.js renamed to spec/helper.ts

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)