Skip to content

Commit

Permalink
Merge pull request #113 from nebula-aac/feat/eslint-config
Browse files Browse the repository at this point in the history
[eslint-config] feat: Create custom `eslint` package
  • Loading branch information
nebula-aac authored Nov 7, 2023
2 parents 2875dab + 958b6c6 commit d2e23b1
Show file tree
Hide file tree
Showing 8 changed files with 507 additions and 10 deletions.
76 changes: 76 additions & 0 deletions packages/eslint-config-sistent/base.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
module.exports = {
env: {
browser: true,
es2021: true
},
extends: [
'eslint:recommended',
'standard-with-typescript',
'plugin:react/recommended',
'plugin:cypress/recommended',
'plugin:prettier/recommended',
],
parser: "@babel/eslint-parser",
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['react', 'cypress'],
rules: {
"@next/next/no-html-link-for-pages": "off",
"@next/next/no-img-element": "off",
"react-hooks/rules-of-hooks": "warn",
"react-hooks/exhaustive-deps": "off",
"jsx-a11y/alt-text": "off",
"valid-typeof": "warn",
"array-bracket-spacing": ["error", "never"],
"comma-style": ["error"],
"jsx-quotes": ["error", "prefer-double"],
"block-scoped-var": "error",
"keyword-spacing": "error",
"no-trailing-spaces": "error",
"object-curly-spacing": ["error", "always"],
"arrow-spacing": ["error", {
"before": true,
"after": true
}],
"key-spacing": ["error", {
"beforeColon": true,
"afterColon": true
}],
"block-spacing": "error",
"brace-style": ["error", "1tbs"],
"indent": ["error", 2, {
"FunctionExpression": {
"parameters": "first"
},
"FunctionDeclaration": {
"parameters": "first"
},
"MemberExpression": 1,
"SwitchCase": 1,
"outerIIFEBody": 0,
"VariableDeclarator": {
"var": 2,
"let": 2,
"const": 3
},
ignoredNodes: ["TemplateLiteral"]
}],
"react/react-in-jsx-scope": "off",
"no-undef": "error",
"react/jsx-uses-vars": [2],
"react/jsx-no-undef": "error",
"no-console": 0,
"no-unused-vars": "error",
"react/jsx-key": "warn",
"no-dupe-keys": "error",
"react/jsx-filename-extension": [1, {
"extensions": [".js", ".jsx"]
}],
"react/prop-types": "off"
}
};
30 changes: 30 additions & 0 deletions packages/eslint-config-sistent/components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
env: {
browser: true,
es2021: true
},
extends: [
'standard-with-typescript',
'plugin:react/recommended',
'plugin:react/recommended',
'plugin:prettier/recommended'
],
overrides: [
{
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
project: null,
sourceType: 'script'
},
rules: {
"@typescript-eslint/*": "off"
}
}
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['react'],
rules: {}
};
2 changes: 2 additions & 0 deletions packages/eslint-config-sistent/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = require("./base.config.js")
module.exports = require("./components.js")
11 changes: 11 additions & 0 deletions packages/eslint-config-sistent/next-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
extends: ["next", "prettier"],
rules: {
"@next/next/no-html-link-for-pages": "off",
},
parserOptions: {
babelOptions: {
presets: [require.resolve("next/babel")],
},
},
};
13 changes: 13 additions & 0 deletions packages/eslint-config-sistent/overrides.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
overrides: [
{
env: {
node: true
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script'
}
}
]
};
13 changes: 13 additions & 0 deletions packages/eslint-config-sistent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@layer5/eslint-config-sistent",
"version": "0.0.0",
"main": "index.js",
"dependencies": {
"eslint-config-next": "^13.4.19",
"eslint-config-prettier": "^9.0.0",
"eslint-config-react": "^1.1.7"
},
"publishConfig": {
"access": "public"
}
}
9 changes: 9 additions & 0 deletions packages/eslint-config-sistent/storybook.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
env: {
browser: true,
node: true // Storybook's configuration can access Node.js APIs
},
rules: {
// ... Storybook specific rules or overrides
}
};
Loading

0 comments on commit d2e23b1

Please sign in to comment.