Skip to content

Commit 778c2bc

Browse files
committed
Fix eslint configuration
1 parent 3cf7236 commit 778c2bc

File tree

2 files changed

+121
-88
lines changed

2 files changed

+121
-88
lines changed

eslint.config.mjs

+119-86
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,149 @@
11
// Automatically generated by running npx @eslint/migrate-config .eslintrc.json
22

3+
import path from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
36
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
7+
import { FlatCompat } from "@eslint/eslintrc";
8+
import js from "@eslint/js";
49
import typescriptEslint from "@typescript-eslint/eslint-plugin";
10+
import tsParser from "@typescript-eslint/parser";
511
import filenames from "eslint-plugin-filenames";
612
import github from "eslint-plugin-github";
713
import _import from "eslint-plugin-import";
814
import noAsyncForeach from "eslint-plugin-no-async-foreach";
9-
import tsParser from "@typescript-eslint/parser";
10-
import path from "node:path";
11-
import { fileURLToPath } from "node:url";
12-
import js from "@eslint/js";
13-
import { FlatCompat } from "@eslint/eslintrc";
15+
import globals from "globals";
1416

1517
const __filename = fileURLToPath(import.meta.url);
1618
const __dirname = path.dirname(__filename);
1719
const compat = new FlatCompat({
18-
baseDirectory: __dirname,
19-
recommendedConfig: js.configs.recommended,
20-
allConfig: js.configs.all
20+
baseDirectory: __dirname,
21+
recommendedConfig: js.configs.recommended,
22+
allConfig: js.configs.all,
2123
});
2224

23-
export default [{
24-
ignores: ["**/webpack.config.js", "lib/**/*", "src/testdata/**/*", "tests/**/*"],
25-
}, ...fixupConfigRules(compat.extends(
26-
"eslint:recommended",
27-
"plugin:@typescript-eslint/recommended",
28-
"plugin:@typescript-eslint/recommended-requiring-type-checking",
29-
"plugin:github/recommended",
30-
"plugin:github/typescript",
31-
"plugin:import/typescript",
32-
)), {
25+
export default [
26+
{
27+
ignores: [
28+
"**/webpack.config.js",
29+
"lib/**/*",
30+
"src/testdata/**/*",
31+
"tests/**/*",
32+
"eslint.config.mjs",
33+
".github/**/*",
34+
],
35+
},
36+
...fixupConfigRules(
37+
compat.extends(
38+
"eslint:recommended",
39+
"plugin:@typescript-eslint/recommended",
40+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
41+
"plugin:github/recommended",
42+
"plugin:github/typescript",
43+
"plugin:import/typescript",
44+
),
45+
),
46+
{
3347
plugins: {
34-
"@typescript-eslint": fixupPluginRules(typescriptEslint),
35-
filenames,
36-
github: fixupPluginRules(github),
37-
import: fixupPluginRules(_import),
38-
"no-async-foreach": noAsyncForeach,
48+
"@typescript-eslint": fixupPluginRules(typescriptEslint),
49+
filenames: fixupPluginRules(filenames),
50+
github: fixupPluginRules(github),
51+
import: fixupPluginRules(_import),
52+
"no-async-foreach": noAsyncForeach,
3953
},
4054

4155
languageOptions: {
42-
parser: tsParser,
43-
ecmaVersion: 5,
44-
sourceType: "script",
56+
parser: tsParser,
57+
ecmaVersion: 5,
58+
sourceType: "module",
4559

46-
parserOptions: {
47-
project: "./tsconfig.json",
48-
},
60+
globals: {
61+
...globals.node,
62+
},
63+
64+
parserOptions: {
65+
project: "./tsconfig.json",
66+
},
4967
},
5068

5169
settings: {
52-
"import/resolver": {
53-
node: {
54-
moduleDirectory: ["node_modules", "src"],
55-
},
56-
57-
typescript: {},
70+
"import/resolver": {
71+
node: {
72+
moduleDirectory: ["node_modules", "src"],
5873
},
74+
75+
typescript: {},
76+
},
77+
"import/ignore": ["sinon", "uuid", "@octokit/plugin-retry"],
5978
},
6079

6180
rules: {
62-
"filenames/match-regex": ["error", "^[a-z0-9-]+(\\.test)?$"],
63-
"i18n-text/no-en": "off",
64-
65-
"import/extensions": ["error", {
66-
json: {},
67-
}],
68-
69-
"import/no-amd": "error",
70-
"import/no-commonjs": "error",
71-
"import/no-cycle": "error",
72-
"import/no-dynamic-require": "error",
73-
74-
"import/no-extraneous-dependencies": ["error", {
75-
devDependencies: true,
76-
}],
77-
78-
"import/no-namespace": "off",
79-
"import/no-unresolved": "error",
80-
"import/no-webpack-loader-syntax": "error",
81-
82-
"import/order": ["error", {
83-
alphabetize: {
84-
order: "asc",
85-
},
86-
87-
"newlines-between": "always",
88-
}],
89-
90-
"max-len": ["error", {
91-
code: 120,
92-
ignoreUrls: true,
93-
ignoreStrings: true,
94-
ignoreTemplateLiterals: true,
95-
}],
96-
97-
"no-async-foreach/no-async-foreach": "error",
98-
"no-sequences": "error",
99-
"no-shadow": "off",
100-
"@typescript-eslint/no-shadow": "error",
101-
"one-var": ["error", "never"],
81+
"filenames/match-regex": ["error", "^[a-z0-9-]+(\\.test)?$"],
82+
"i18n-text/no-en": "off",
83+
84+
"import/extensions": [
85+
"error",
86+
{
87+
json: {},
88+
},
89+
],
90+
91+
"import/no-amd": "error",
92+
"import/no-commonjs": "error",
93+
"import/no-cycle": "error",
94+
"import/no-dynamic-require": "error",
95+
96+
"import/no-extraneous-dependencies": [
97+
"error",
98+
{
99+
devDependencies: true,
100+
},
101+
],
102+
103+
"import/no-namespace": "off",
104+
"import/no-unresolved": "error",
105+
"import/no-webpack-loader-syntax": "error",
106+
107+
"import/order": [
108+
"error",
109+
{
110+
alphabetize: {
111+
order: "asc",
112+
},
113+
114+
"newlines-between": "always",
115+
},
116+
],
117+
118+
"max-len": [
119+
"error",
120+
{
121+
code: 120,
122+
ignoreUrls: true,
123+
ignoreStrings: true,
124+
ignoreTemplateLiterals: true,
125+
},
126+
],
127+
128+
"no-async-foreach/no-async-foreach": "error",
129+
"no-sequences": "error",
130+
"no-shadow": "off",
131+
"@typescript-eslint/no-shadow": "error",
132+
"one-var": ["error", "never"],
102133
},
103-
}, {
104-
files: ["**"],
134+
},
135+
{
136+
files: ["**/*.ts", "**/*.js"],
105137

106138
rules: {
107-
"@typescript-eslint/no-explicit-any": "off",
108-
"@typescript-eslint/no-unsafe-assignment": "off",
109-
"@typescript-eslint/no-unsafe-member-access": "off",
110-
"@typescript-eslint/no-var-requires": "off",
111-
"@typescript-eslint/prefer-regexp-exec": "off",
112-
"@typescript-eslint/require-await": "off",
113-
"@typescript-eslint/restrict-template-expressions": "off",
114-
"func-style": "off",
139+
"@typescript-eslint/no-explicit-any": "off",
140+
"@typescript-eslint/no-unsafe-assignment": "off",
141+
"@typescript-eslint/no-unsafe-member-access": "off",
142+
"@typescript-eslint/no-var-requires": "off",
143+
"@typescript-eslint/prefer-regexp-exec": "off",
144+
"@typescript-eslint/require-await": "off",
145+
"@typescript-eslint/restrict-template-expressions": "off",
146+
"func-style": "off",
115147
},
116-
}];
148+
},
149+
];

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"build": "tsc --build",
88
"test": "ava src/**.test.ts --serial --verbose",
99
"test-debug": "ava src/**.test.ts --serial --verbose --timeout=20m",
10-
"lint": "eslint --report-unused-disable-directives --max-warnings=0 . --ext .js,.ts",
11-
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --ext .js,.ts --fix",
10+
"lint": "eslint --report-unused-disable-directives --max-warnings=0 .",
11+
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",
1212
"removeNPMAbsolutePaths": "removeNPMAbsolutePaths . --force"
1313
},
1414
"ava": {

0 commit comments

Comments
 (0)