/
.eslintrc.js
106 lines (106 loc) · 2.42 KB
/
.eslintrc.js
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
102
103
104
105
106
module.exports = {
env: {
node: true,
jest: true,
},
extends: [
"eslint:recommended",
"airbnb-base",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"airbnb-typescript/base",
"plugin:n/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:promise/recommended",
"plugin:sonarjs/recommended",
"plugin:unicorn/recommended",
"plugin:security/recommended-legacy",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: true,
},
plugins: [
"@typescript-eslint",
"promise",
"sonarjs",
"unicorn",
"import",
"security",
],
reportUnusedDisableDirectives: true,
settings: {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
node: true,
},
},
rules: {
"no-console": ["error", { allow: ["info", "warn", "error"] }],
"no-new": "off",
"no-restricted-syntax": "off",
"import/no-restricted-paths": [
"error",
{
zones: [
{
target: "./src",
from: "./bin",
message: 'Main code should not import from "bin/*".',
},
],
},
],
"import/prefer-default-export": "off",
// https://github.com/eslint-community/eslint-plugin-n/issues/84
"n/no-missing-import": "off",
"unicorn/prevent-abbreviations": [
"error",
{
replacements: {
// "props" is very common in CDK code
props: {
properties: false,
},
},
},
],
},
overrides: [
{
files: ["src/stacks/**/*.ts"],
rules: {
"no-restricted-syntax": [
"error",
{
selector:
"MemberExpression[object.name='process'][property.name='env']",
message:
"Usage of environment variables are not allowed inside Stacks. Pass them as StackProps instead from `./bin/app.ts`.",
},
],
},
},
{
files: ["**/__tests__/**/*.test.ts"],
plugins: ["jest"],
extends: ["plugin:jest/recommended"],
rules: {
"jest/expect-expect": "off",
"sonarjs/no-duplicate-string": "off",
},
},
{
files: ["**/*.js"],
rules: {
"unicorn/prefer-module": "off",
},
},
],
};