Skip to content

Commit d2e23b1

Browse files
authored
Merge pull request #113 from nebula-aac/feat/eslint-config
[eslint-config] feat: Create custom `eslint` package
2 parents 2875dab + 958b6c6 commit d2e23b1

File tree

8 files changed

+507
-10
lines changed

8 files changed

+507
-10
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true
5+
},
6+
extends: [
7+
'eslint:recommended',
8+
'standard-with-typescript',
9+
'plugin:react/recommended',
10+
'plugin:cypress/recommended',
11+
'plugin:prettier/recommended',
12+
],
13+
parser: "@babel/eslint-parser",
14+
parserOptions: {
15+
ecmaFeatures: {
16+
jsx: true
17+
},
18+
ecmaVersion: 'latest',
19+
sourceType: 'module',
20+
},
21+
plugins: ['react', 'cypress'],
22+
rules: {
23+
"@next/next/no-html-link-for-pages": "off",
24+
"@next/next/no-img-element": "off",
25+
"react-hooks/rules-of-hooks": "warn",
26+
"react-hooks/exhaustive-deps": "off",
27+
"jsx-a11y/alt-text": "off",
28+
"valid-typeof": "warn",
29+
"array-bracket-spacing": ["error", "never"],
30+
"comma-style": ["error"],
31+
"jsx-quotes": ["error", "prefer-double"],
32+
"block-scoped-var": "error",
33+
"keyword-spacing": "error",
34+
"no-trailing-spaces": "error",
35+
"object-curly-spacing": ["error", "always"],
36+
"arrow-spacing": ["error", {
37+
"before": true,
38+
"after": true
39+
}],
40+
"key-spacing": ["error", {
41+
"beforeColon": true,
42+
"afterColon": true
43+
}],
44+
"block-spacing": "error",
45+
"brace-style": ["error", "1tbs"],
46+
"indent": ["error", 2, {
47+
"FunctionExpression": {
48+
"parameters": "first"
49+
},
50+
"FunctionDeclaration": {
51+
"parameters": "first"
52+
},
53+
"MemberExpression": 1,
54+
"SwitchCase": 1,
55+
"outerIIFEBody": 0,
56+
"VariableDeclarator": {
57+
"var": 2,
58+
"let": 2,
59+
"const": 3
60+
},
61+
ignoredNodes: ["TemplateLiteral"]
62+
}],
63+
"react/react-in-jsx-scope": "off",
64+
"no-undef": "error",
65+
"react/jsx-uses-vars": [2],
66+
"react/jsx-no-undef": "error",
67+
"no-console": 0,
68+
"no-unused-vars": "error",
69+
"react/jsx-key": "warn",
70+
"no-dupe-keys": "error",
71+
"react/jsx-filename-extension": [1, {
72+
"extensions": [".js", ".jsx"]
73+
}],
74+
"react/prop-types": "off"
75+
}
76+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true
5+
},
6+
extends: [
7+
'standard-with-typescript',
8+
'plugin:react/recommended',
9+
'plugin:react/recommended',
10+
'plugin:prettier/recommended'
11+
],
12+
overrides: [
13+
{
14+
files: ['.eslintrc.{js,cjs}'],
15+
parserOptions: {
16+
project: null,
17+
sourceType: 'script'
18+
},
19+
rules: {
20+
"@typescript-eslint/*": "off"
21+
}
22+
}
23+
],
24+
parserOptions: {
25+
ecmaVersion: 'latest',
26+
sourceType: 'module'
27+
},
28+
plugins: ['react'],
29+
rules: {}
30+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module.exports = require("./base.config.js")
2+
module.exports = require("./components.js")
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
extends: ["next", "prettier"],
3+
rules: {
4+
"@next/next/no-html-link-for-pages": "off",
5+
},
6+
parserOptions: {
7+
babelOptions: {
8+
presets: [require.resolve("next/babel")],
9+
},
10+
},
11+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
overrides: [
3+
{
4+
env: {
5+
node: true
6+
},
7+
files: ['.eslintrc.{js,cjs}'],
8+
parserOptions: {
9+
sourceType: 'script'
10+
}
11+
}
12+
]
13+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@layer5/eslint-config-sistent",
3+
"version": "0.0.0",
4+
"main": "index.js",
5+
"dependencies": {
6+
"eslint-config-next": "^13.4.19",
7+
"eslint-config-prettier": "^9.0.0",
8+
"eslint-config-react": "^1.1.7"
9+
},
10+
"publishConfig": {
11+
"access": "public"
12+
}
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
node: true // Storybook's configuration can access Node.js APIs
5+
},
6+
rules: {
7+
// ... Storybook specific rules or overrides
8+
}
9+
};

0 commit comments

Comments
 (0)