Skip to content

Commit b0dd7f0

Browse files
committed
[all] Fixes linting process, fixes lint errors and warns
1 parent cd5ccf5 commit b0dd7f0

File tree

10 files changed

+1564
-5170
lines changed

10 files changed

+1564
-5170
lines changed

eslint.config.mjs

+70-28
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,93 @@
1-
import globals from 'globals'
2-
import eslintjs from "@eslint/js";
3-
import prettier from "eslint-plugin-prettier/recommended";
1+
import { fixupPluginRules } from "@eslint/compat";
2+
import { FlatCompat } from "@eslint/eslintrc";
3+
import js from "@eslint/js";
4+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
5+
import tsParser from "@typescript-eslint/parser";
6+
import _import from "eslint-plugin-import";
47
import react from "eslint-plugin-react";
58
import reactHooks from "eslint-plugin-react-hooks";
6-
import tseslint from "typescript-eslint";
9+
import globals from "globals";
10+
import path from "node:path";
11+
import { fileURLToPath } from "node:url";
712

8-
export default tseslint.config(
9-
eslintjs.configs.recommended,
10-
tseslint.configs.recommended,
11-
prettier,
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = path.dirname(__filename);
15+
const compat = new FlatCompat({
16+
baseDirectory: __dirname,
17+
recommendedConfig: js.configs.recommended,
18+
allConfig: js.configs.all,
19+
});
20+
21+
export default [
22+
{
23+
ignores: [
24+
"**/*.js",
25+
// Built files
26+
"**/dist/*",
27+
"**/build/*",
28+
"**/node_modules/*",
29+
// Doc and examples
30+
"**/storybook-static/*",
31+
"**/typedoc",
32+
"**/.docusaurus",
33+
],
34+
},
35+
...compat.extends(
36+
"eslint:recommended",
37+
"plugin:@typescript-eslint/recommended",
38+
"plugin:@typescript-eslint/eslint-recommended",
39+
"prettier",
40+
),
1241
{
13-
ignores: ["**/build/*", "**/dist/*", "**/lib/*"],
14-
files: ["**/*.{ts,tsx}"],
1542
plugins: {
16-
"react": react,
43+
import: fixupPluginRules(_import),
44+
"@typescript-eslint": typescriptEslint,
45+
react: react,
1746
"react-hooks": reactHooks,
1847
},
48+
1949
settings: {
2050
react: {
2151
version: "detect",
2252
},
2353
},
54+
2455
languageOptions: {
25-
ecmaVersion: 2020,
26-
globals: globals.browser,
27-
parserOptions: {
28-
ecmaFeatures: {
29-
jsx: true,
30-
},
56+
globals: {
57+
...globals.jest,
58+
...globals.browser,
3159
},
60+
61+
parser: tsParser,
3262
},
63+
3364
rules: {
3465
...react.configs.recommended.rules,
3566
...reactHooks.configs.recommended.rules,
3667
"react/react-in-jsx-scope": "off",
37-
'react/prop-types': 'off',
68+
"react/prop-types": "off",
3869
"react/display-name": "off",
39-
"@typescript-eslint/no-unused-vars": ["warn", {
40-
"args": "all",
41-
"argsIgnorePattern": "^_",
42-
"caughtErrors": "all",
43-
"caughtErrorsIgnorePattern": "^_",
44-
"destructuredArrayIgnorePattern": "^_",
45-
"varsIgnorePattern": "^_",
46-
"ignoreRestSiblings": true
47-
}],
70+
"@typescript-eslint/no-unused-vars": [
71+
"warn",
72+
{
73+
args: "all",
74+
argsIgnorePattern: "^_",
75+
caughtErrors: "all",
76+
caughtErrorsIgnorePattern: "^_",
77+
destructuredArrayIgnorePattern: "^_",
78+
varsIgnorePattern: "^_",
79+
ignoreRestSiblings: true,
80+
},
81+
],
4882
"no-extra-boolean-cast": "off",
4983
},
5084
},
51-
);
85+
{
86+
files: ["**/dist/*.d.ts", "**/dist/**/*.d.ts", "**/dist/*.d.mts", "**/dist/**/*.d.mts"],
87+
88+
rules: {
89+
"import/extensions": "off",
90+
"@typescript-eslint/no-explicit-any": "off",
91+
},
92+
},
93+
];

i18next-scanner.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313

1414
// Put a blank string as initial translation
1515
// (useful for Weblate be marked as 'not yet translated', see later)
16-
defaultValue: (lng, ns, key) => "",
16+
defaultValue: (_lng, _ns, _key) => "",
1717

1818
// Location of translation files
1919
resource: {

0 commit comments

Comments
 (0)