Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct the nested structure for eslint config #104

Merged
merged 8 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ jobs:
cd ./example-site/
node ./../src/cli.js ci
name: Run test - ci install projects
- run:
command: |
cd ./example-site/
node ./../src/cli.js build standards --once
name: Run test - Compile Standards Plugin
- run:
command: |
cd ./example-site/
Expand Down
81 changes: 39 additions & 42 deletions configs/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
es2021: true,
node: true,
},
extends: ['airbnb', 'prettier'],
extends: ['airbnb', 'prettier', 'plugin:@typescript-eslint/recommended'],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
Expand All @@ -25,51 +25,48 @@ module.exports = {
es2021: true,
node: true,
},
extends: ['airbnb', 'prettier', 'plugin:@typescript-eslint/recommended'],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
babelOptions: {
...babelConfig,
},
},
plugins: ['@babel', 'react', 'prettier', 'jsdoc', 'import', '@typescript-eslint/eslint-plugin'],
settings: {
'import/resolver': eslintResolver(),
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
rules: {
complexity: ['error', 10],
'prettier/prettier': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'react/react-in-jsx-scope': 0,
'react/prop-types': 0,
'react/forbid-prop-types': 0,
'react/require-default-props': 0,
'arrow-parens': 2,
'jsdoc/require-jsdoc': [
'error',
{
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: true,
},
},
plugins: ['@babel', 'react', 'prettier', 'jsdoc', 'import', '@typescript-eslint/eslint-plugin'],
rules: {
complexity: ['error', 10],
'prettier/prettier': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-filename-extension': [
1,
{
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
],
'react/react-in-jsx-scope': 0,
'react/prop-types': 0,
'react/forbid-prop-types': 0,
'react/require-default-props': 0,
'arrow-parens': 2,
'jsdoc/require-jsdoc': [
'error',
{
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: true,
},
],
},
}
};
},
],
},
};
1 change: 1 addition & 0 deletions example-site/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "test-project",
"prettier": "./../configs/prettier",
"eslintConfig": {
"extends": "./../configs/eslint"
},
Expand Down
Empty file.
11 changes: 11 additions & 0 deletions example-site/plugins/standards/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions example-site/plugins/standards/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "standards",
"prettier": "./../../../configs/prettier",
"eslintConfig": {
"extends": "./../../../configs/eslint"
},
"dependencies": {},
"devDependencies": {}
}
15 changes: 15 additions & 0 deletions example-site/plugins/standards/src/entrypoints/jsx-standards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* A simple example for reproducing incorrect JSX issues
* in ESLint:
* - react/react-in-jsx-scope
* - react/jsx-filename-extension
*/
export default () => (
<div>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
);
3 changes: 3 additions & 0 deletions example-site/plugins/standards/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../../configs/tsconfig"
}