Skip to content

Commit 9d6b13e

Browse files
committed
refactor eslint config
Signed-off-by: Brian DeHamer <[email protected]>
1 parent 3236bff commit 9d6b13e

16 files changed

+204
-150
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323
cache: npm
2424
- name: Install dependencies
2525
run: npm ci
26+
- name: Run build
27+
run: npm run build
2628
- name: Run linter
2729
run: npm run lint:check
2830
- name: Run formatter
2931
run: npm run prettier:check
30-
- name: Run build
31-
run: npm run build
3232

3333
run-tests:
3434
name: Run tests

eslint.config.mjs

+28-38
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,32 @@
1-
import typescriptEslint from "@typescript-eslint/eslint-plugin";
2-
import tsParser from "@typescript-eslint/parser";
3-
import path from "node:path";
4-
import { fileURLToPath } from "node:url";
5-
import js from "@eslint/js";
6-
import { FlatCompat } from "@eslint/eslintrc";
7-
8-
const __filename = fileURLToPath(import.meta.url);
9-
const __dirname = path.dirname(__filename);
10-
const compat = new FlatCompat({
11-
baseDirectory: __dirname,
12-
recommendedConfig: js.configs.recommended,
13-
allConfig: js.configs.all
14-
});
15-
16-
export default [{
17-
ignores: ["**/node_modules", "**/dist", "**/*.js"],
18-
}, ...compat.extends(
19-
"eslint:recommended",
20-
"plugin:@typescript-eslint/eslint-recommended",
21-
"plugin:@typescript-eslint/recommended",
22-
), {
23-
files: ["**/*.ts", "**/*.tsx"],
24-
25-
plugins: {
26-
"@typescript-eslint": typescriptEslint,
27-
},
28-
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
export default tseslint.config(
4+
{
5+
ignores: [
6+
'**/coverage',
7+
'**/dist',
8+
'**/__fixtures__',
9+
'**/jest.config.js',
10+
'**/jest.config.base.js',
11+
'examples',
12+
'packages/canonical-json',
13+
'eslint.config.mjs',
14+
],
15+
},
16+
eslint.configs.recommended,
17+
tseslint.configs.recommendedTypeChecked,
18+
{
2919
languageOptions: {
30-
parser: tsParser,
31-
sourceType: "module",
32-
33-
parserOptions: {
34-
project: "tsconfig.base.json",
35-
},
20+
parserOptions: {
21+
projectService: ['./packages/*/tsconfig.json'],
22+
tsconfigRootDir: import.meta.dirname,
23+
},
3624
},
37-
3825
rules: {
39-
"@typescript-eslint/require-await": "error",
40-
"@typescript-eslint/no-unused-vars": ["error", { "caughtErrors": "none" }]
26+
"@typescript-eslint/no-base-to-string": "off",
27+
"@typescript-eslint/no-unused-vars": ["error", { "caughtErrors": "none" }],
28+
"@typescript-eslint/require-await": "error",
29+
"@typescript-eslint/restrict-template-expressions": "off",
4130
},
42-
}];
31+
}
32+
);

0 commit comments

Comments
 (0)