Skip to content

Commit 4d73e00

Browse files
Eldar Hasanoviceldar-hasanovic
Eldar Hasanovic
authored andcommitted
fix(eslint.config.mjs): rewriting eslint config to satisfy eslint
1 parent 01273c3 commit 4d73e00

File tree

1 file changed

+31
-35
lines changed

1 file changed

+31
-35
lines changed

eslint.config.mjs

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,40 @@ import react from "eslint-plugin-react";
22
import typescriptEslint from "@typescript-eslint/eslint-plugin";
33
import globals from "globals";
44
import tsParser from "@typescript-eslint/parser";
5-
import path from "node:path";
6-
import { fileURLToPath } from "node:url";
75
import js from "@eslint/js";
8-
import { FlatCompat } from "@eslint/eslintrc";
96

10-
const __filename = fileURLToPath(import.meta.url);
11-
const __dirname = path.dirname(__filename);
12-
const compat = new FlatCompat({
13-
baseDirectory: __dirname,
14-
recommendedConfig: js.configs.recommended,
15-
allConfig: js.configs.all
16-
});
17-
18-
export default [...compat.extends(
19-
"eslint:recommended",
20-
"plugin:react/recommended",
21-
"plugin:@typescript-eslint/recommended",
22-
), {
23-
plugins: {
24-
react,
25-
"@typescript-eslint": typescriptEslint,
26-
},
27-
28-
languageOptions: {
29-
globals: {
30-
...globals.browser,
7+
export default [
8+
js.configs.recommended,
9+
{
10+
files: ["**/*.{js,jsx,ts,tsx}"],
11+
plugins: {
12+
react,
13+
"@typescript-eslint": typescriptEslint,
14+
},
15+
languageOptions: {
16+
globals: {
17+
...globals.browser,
18+
},
19+
parser: tsParser,
20+
ecmaVersion: "latest",
21+
sourceType: "module",
22+
},
23+
settings: {
24+
react: {
25+
version: "detect",
26+
},
27+
},
28+
rules: {
29+
...typescriptEslint.configs.recommended.rules,
30+
...react.configs.recommended.rules,
3131
},
32-
33-
parser: tsParser,
34-
ecmaVersion: "latest",
35-
sourceType: "module",
3632
},
37-
38-
settings: {
39-
react: {
40-
version: "detect",
33+
{
34+
files: ["**/*.test.{js,jsx,ts,tsx}"],
35+
languageOptions: {
36+
globals: {
37+
...globals.jest,
38+
},
4139
},
4240
},
43-
44-
rules: {},
45-
}];
41+
];

0 commit comments

Comments
 (0)