-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
101 lines (97 loc) · 2.81 KB
/
Copy patheslint.config.mjs
File metadata and controls
101 lines (97 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { FlatCompat } from "@eslint/eslintrc";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import importPlugin from "eslint-plugin-import";
import jsdoc from "eslint-plugin-jsdoc";
import jsxA11y from "eslint-plugin-jsx-a11y";
import noRel from "eslint-plugin-no-relative-import-paths";
import noSecrets from "eslint-plugin-no-secrets";
import promise from "eslint-plugin-promise";
import security from "eslint-plugin-security";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import { dirname } from "path";
import { fileURLToPath } from "url";
/** @type {string} */
const __filename = fileURLToPath(import.meta.url);
/** @type {string} */
const __dirname = dirname(__filename);
/** @type {import("@eslint/eslintrc").FlatCompat} */
const compat = new FlatCompat({
baseDirectory: __dirname,
});
/** @type {import("eslint").Linter.Config[]} */
const eslintConfig = [
...compat.extends("plugin:prettier/recommended"),
{
ignores: ["node_modules", "dist", "coverage"],
},
{
files: ["**/*.js", "**/*.ts"],
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
sourceType: "module",
},
},
settings: {
"import/resolver": {
typescript: {
project: "./tsconfig.json",
},
},
},
plugins: {
"@typescript-eslint": tsPlugin,
import: importPlugin,
jsdoc: jsdoc,
"jsx-a11y": jsxA11y,
"no-secrets": noSecrets,
promise: promise,
security: security,
"simple-import-sort": simpleImportSort,
"no-relative-import-paths": noRel,
},
rules: {
"security/detect-object-injection": "warn",
"promise/always-return": "warn",
"promise/no-return-wrap": "error",
"promise/param-names": "error",
"promise/catch-or-return": "warn",
"import/no-unresolved": "error",
"import/order": "off",
"no-restricted-syntax": [
"error",
{
selector: "ImportDeclaration[source.value=/\\\\/]",
message: "Use forward slashes (/) in imports, not backslashes (\\).",
},
],
"no-secrets/no-secrets": "warn",
"jsx-a11y/alt-text": "warn",
"jsx-a11y/anchor-is-valid": "warn",
"jsx-a11y/aria-role": "warn",
"jsdoc/require-description-complete-sentence": "warn",
"max-len": [
"warn",
{
code: 79,
comments: 79,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
"capitalized-comments": [
"warn",
"always",
{
ignorePattern: "eslint",
ignoreInlineComments: true,
ignoreConsecutiveComments: true,
},
],
},
},
];
export default eslintConfig;