From a29750b5bf760e37dfb8470e76126b8e380de689 Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Mon, 5 Feb 2024 10:15:09 +0000 Subject: [PATCH 1/8] fix: corrects the nested structure for eslint config --- configs/eslint.js | 80 +++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/configs/eslint.js b/configs/eslint.js index 7ea1f89..a5cc6a5 100644 --- a/configs/eslint.js +++ b/configs/eslint.js @@ -1,3 +1,4 @@ +const react = require('eslint-plugin-react'); const babelConfig = require('./babel.js'); const { eslintResolver } = require('./../src/utils/get-alias'); @@ -13,7 +14,7 @@ module.exports = { es2021: true, node: true, }, - extends: ['airbnb', 'prettier'], + extends: ['airbnb', 'prettier', 'plugin:@typescript-eslint/recommended'], parser: '@babel/eslint-parser', parserOptions: { requireConfigFile: false, @@ -25,51 +26,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, }, - ], - }, - } + }, + ], + }, }; From 4c427d20de4041301629511068442446538ec9e2 Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Mon, 5 Feb 2024 10:23:49 +0000 Subject: [PATCH 2/8] fix: remove unused package --- configs/eslint.js | 3 +-- example-site/package.json | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/eslint.js b/configs/eslint.js index a5cc6a5..b59de29 100644 --- a/configs/eslint.js +++ b/configs/eslint.js @@ -1,4 +1,3 @@ -const react = require('eslint-plugin-react'); const babelConfig = require('./babel.js'); const { eslintResolver } = require('./../src/utils/get-alias'); @@ -70,4 +69,4 @@ module.exports = { }, ], }, -}; +}; \ No newline at end of file diff --git a/example-site/package.json b/example-site/package.json index d71af10..1d39084 100644 --- a/example-site/package.json +++ b/example-site/package.json @@ -1,5 +1,6 @@ { "name": "test-project", + "prettier": "./../configs/prettier", "eslintConfig": { "extends": "./../configs/eslint" }, From b71384e3eecb3bab3b2c6eb6947e433005d6944a Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Mon, 5 Feb 2024 10:26:25 +0000 Subject: [PATCH 3/8] test: example for jsx issues test case --- .../test-plugin/src/entrypoints/jsx-test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 example-site/plugins/test-plugin/src/entrypoints/jsx-test.js diff --git a/example-site/plugins/test-plugin/src/entrypoints/jsx-test.js b/example-site/plugins/test-plugin/src/entrypoints/jsx-test.js new file mode 100644 index 0000000..e76d507 --- /dev/null +++ b/example-site/plugins/test-plugin/src/entrypoints/jsx-test.js @@ -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 () => ( +
+
    +
  • Item 1
  • +
  • Item 2
  • +
  • Item 3
  • +
+
+); From 0582ee0d101191bf6f52fca0618eaed76a9cbf6e Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Mon, 5 Feb 2024 11:06:06 +0000 Subject: [PATCH 4/8] tests: add plugin for working against BB standards --- .circleci/config.yml | 5 +++++ example-site/plugins/standards/package.json | 5 +++++ .../src/entrypoints/jsx-standards.js} | 0 example-site/plugins/standards/tsconfig.json | 3 +++ 4 files changed, 13 insertions(+) create mode 100644 example-site/plugins/standards/package.json rename example-site/plugins/{test-plugin/src/entrypoints/jsx-test.js => standards/src/entrypoints/jsx-standards.js} (100%) create mode 100644 example-site/plugins/standards/tsconfig.json diff --git a/.circleci/config.yml b/.circleci/config.yml index d6f50a5..c73a4db 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 - build projects - run: command: | cd ./example-site/ diff --git a/example-site/plugins/standards/package.json b/example-site/plugins/standards/package.json new file mode 100644 index 0000000..9b0b813 --- /dev/null +++ b/example-site/plugins/standards/package.json @@ -0,0 +1,5 @@ +{ + "name": "standards", + "dependencies": {}, + "devDependencies": {} +} diff --git a/example-site/plugins/test-plugin/src/entrypoints/jsx-test.js b/example-site/plugins/standards/src/entrypoints/jsx-standards.js similarity index 100% rename from example-site/plugins/test-plugin/src/entrypoints/jsx-test.js rename to example-site/plugins/standards/src/entrypoints/jsx-standards.js diff --git a/example-site/plugins/standards/tsconfig.json b/example-site/plugins/standards/tsconfig.json new file mode 100644 index 0000000..f6f9d91 --- /dev/null +++ b/example-site/plugins/standards/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../configs/tsconfig" +} \ No newline at end of file From 88d38dadd705408197d3b6a6cc115f5e4ee97c67 Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Mon, 5 Feb 2024 11:09:58 +0000 Subject: [PATCH 5/8] chore: set package configs --- example-site/plugins/standards/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/example-site/plugins/standards/package.json b/example-site/plugins/standards/package.json index 9b0b813..49f9e76 100644 --- a/example-site/plugins/standards/package.json +++ b/example-site/plugins/standards/package.json @@ -1,5 +1,9 @@ { "name": "standards", + "prettier": "./../../../configs/prettier", + "eslintConfig": { + "extends": "./../../../configs/eslint" + }, "dependencies": {}, "devDependencies": {} } From 6df4c434cf5add76151cde7a21a0125142c242cb Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Mon, 5 Feb 2024 11:12:54 +0000 Subject: [PATCH 6/8] fix: add package-lock for ci --- example-site/plugins/standards/package-lock.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 example-site/plugins/standards/package-lock.json diff --git a/example-site/plugins/standards/package-lock.json b/example-site/plugins/standards/package-lock.json new file mode 100644 index 0000000..46f9809 --- /dev/null +++ b/example-site/plugins/standards/package-lock.json @@ -0,0 +1,11 @@ +{ + "name": "standards", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "standards", + "devDependencies": {} + } + } +} From 777504e6f4188cc2c8e04ccb20f4dc28af523567 Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Mon, 5 Feb 2024 11:15:57 +0000 Subject: [PATCH 7/8] fix: add inc directory --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c73a4db..6b54c97 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,7 +89,7 @@ jobs: command: | cd ./example-site/ node ./../src/cli.js build standards --once - name: Run test - build projects + name: Run test - Compile Standards Plugin - run: command: | cd ./example-site/ From 71b0d266542fdcc654c373ea892f3207dda7258c Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Mon, 5 Feb 2024 11:21:11 +0000 Subject: [PATCH 8/8] fix: add gitkeep --- example-site/plugins/standards/inc/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 example-site/plugins/standards/inc/.gitkeep diff --git a/example-site/plugins/standards/inc/.gitkeep b/example-site/plugins/standards/inc/.gitkeep new file mode 100644 index 0000000..e69de29