Skip to content

Commit

Permalink
Merge pull request #104 from ampersarnie/hotfix/eslint-config
Browse files Browse the repository at this point in the history
Correct the nested structure for eslint config
  • Loading branch information
ampersarnie authored Feb 19, 2024
2 parents 33b0c7e + 71b0d26 commit 67fe283
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 42 deletions.
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"
}

0 comments on commit 67fe283

Please sign in to comment.