From 4424b6799ad0946092d9adf6d96973261fa1ac77 Mon Sep 17 00:00:00 2001 From: capitnflam Date: Fri, 15 Mar 2024 22:26:00 +0100 Subject: [PATCH 1/9] feat(react): add some security linting (#10) --- package-lock.json | 31 ++++++++++++++++++++++++++++++- package.json | 4 +++- src/configs/react.ts | 2 ++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 23665ba..3961070 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,11 @@ "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.29.1", "eslint-plugin-jsx-a11y": "6.8.0", + "eslint-plugin-no-unsanitized": "4.0.2", "eslint-plugin-react": "7.34.0", "eslint-plugin-react-hooks": "4.6.0", - "eslint-plugin-unicorn": "51.0.1" + "eslint-plugin-unicorn": "51.0.1", + "eslint-plugin-xss": "0.1.12" }, "devDependencies": { "@commitlint/cli": "19.2.0", @@ -3288,6 +3290,14 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" }, + "node_modules/eslint-plugin-no-unsanitized": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-4.0.2.tgz", + "integrity": "sha512-Pry0S9YmHoz8NCEMRQh7N0Yexh2MYCNPIlrV52hTmS7qXnTghWsjXouF08bgsrrZqaW9tt1ZiK3j5NEmPE+EjQ==", + "peerDependencies": { + "eslint": "^6 || ^7 || ^8" + } + }, "node_modules/eslint-plugin-react": { "version": "7.34.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.34.0.tgz", @@ -3531,6 +3541,17 @@ "node": ">=8" } }, + "node_modules/eslint-plugin-xss": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/eslint-plugin-xss/-/eslint-plugin-xss-0.1.12.tgz", + "integrity": "sha512-L5oYaD//ZE7fKNtWUfVgYTRW19jrZlvaHe2swyFLxXQ5pwVQLivi5m92rtXd/ww8yqg4Drasqyi0hlBmhf9YQg==", + "dependencies": { + "requireindex": "~1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -9734,6 +9755,14 @@ "node": ">=0.10.0" } }, + "node_modules/requireindex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.1.0.tgz", + "integrity": "sha512-LBnkqsDE7BZKvqylbmn7lTIVdpx4K/QCduRATpO5R+wtPmky/a8pN1bO2D6wXppn1497AJF9mNjqAXr6bdl9jg==", + "engines": { + "node": ">=0.10.5" + } + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", diff --git a/package.json b/package.json index ab4cc37..bd9f8e0 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,11 @@ "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.29.1", "eslint-plugin-jsx-a11y": "6.8.0", + "eslint-plugin-no-unsanitized": "4.0.2", "eslint-plugin-react": "7.34.0", "eslint-plugin-react-hooks": "4.6.0", - "eslint-plugin-unicorn": "51.0.1" + "eslint-plugin-unicorn": "51.0.1", + "eslint-plugin-xss": "0.1.12" }, "devDependencies": { "@commitlint/cli": "19.2.0", diff --git a/src/configs/react.ts b/src/configs/react.ts index c16a139..3beb944 100644 --- a/src/configs/react.ts +++ b/src/configs/react.ts @@ -8,6 +8,8 @@ export const react: ESLintConfig = { 'plugin:react/jsx-runtime', 'plugin:react-hooks/recommended', 'plugin:jsx-a11y/recommended', + 'plugin:xss/recommended', + 'plugin:no-unsanitized/DOM', ], settings: { react: { From 8afc82a7ee5de0fada0bdca266f5575eb2eab1e9 Mon Sep 17 00:00:00 2001 From: capitnflam Date: Fri, 15 Mar 2024 23:15:08 +0100 Subject: [PATCH 2/9] ci: add check workflow (#11) --- .github/dependabot.yml | 12 ++++++------ .github/workflows/pr-check.yml | 32 ++++++++++++++++++++++++++++++++ package.json | 3 ++- 3 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pr-check.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9cc608e..2d3d263 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,11 +5,11 @@ version: 2 updates: - - package-ecosystem: "npm" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: 'npm' # See documentation for possible values + directory: '/' # Location of package manifests schedule: - interval: "monthly" - - package-ecosystem: "github-actions" - directory: "/" + interval: 'monthly' + - package-ecosystem: 'github-actions' + directory: '/' schedule: - interval: "monthly" + interval: 'monthly' diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 0000000..f8eb476 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,32 @@ +name: PR Check + +on: + push: + branches-ignore: + - main + +jobs: + pr-check: + name: PR Check + runs-on: ubuntu-latest + env: + HUSKY: 0 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - name: Install dependencies + run: npm ci + - name: Lint + run: npm run lint + - name: Type check + run: npm run type-check + - name: Build + run: npm run build + # - name: Test + # run: npm run test diff --git a/package.json b/package.json index bd9f8e0..292d183 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "lint": "prettier --check .", "pre-commit": "lint-staged", "prepare": "husky", - "semantic-release": "semantic-release" + "semantic-release": "semantic-release", + "type-check": "tsc --pretty --noEmit" }, "bugs": "https://github.com/capitnflam/eslint-plugin/issues", "dependencies": { From 07d1f9a40cbfe6496af40ebdb42a57136e2ad1a0 Mon Sep 17 00:00:00 2001 From: capitnflam Date: Fri, 15 Mar 2024 23:19:49 +0100 Subject: [PATCH 3/9] ci: add auto assign action (#14) --- .github/workflows/auto-author-assign.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/auto-author-assign.yml diff --git a/.github/workflows/auto-author-assign.yml b/.github/workflows/auto-author-assign.yml new file mode 100644 index 0000000..60adc81 --- /dev/null +++ b/.github/workflows/auto-author-assign.yml @@ -0,0 +1,14 @@ +name: Auto Author Assign + +on: + pull_request_target: + types: [opened, reopened] + +permissions: + pull-requests: write + +jobs: + assign-author: + runs-on: ubuntu-latest + steps: + - uses: toshimaru/auto-author-assign@v2.1.0 From 738e28cc2586fb29c0dc277b6c9c5d45d334d349 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 23:54:10 +0000 Subject: [PATCH 4/9] chore(deps-dev): bump @types/node from 20.11.27 to 20.11.28 (#13) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.27 to 20.11.28.
Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=20.11.27&new-version=20.11.28)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3961070..ff3c145 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@commitlint/config-conventional": "19.1.0", "@commitlint/types": "19.0.3", "@types/eslint": "8.56.5", - "@types/node": "20.11.27", + "@types/node": "20.11.28", "husky": "9.0.11", "lint-staged": "15.2.2", "prettier": "3.2.5", @@ -1391,9 +1391,9 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==" }, "node_modules/@types/node": { - "version": "20.11.27", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.27.tgz", - "integrity": "sha512-qyUZfMnCg1KEz57r7pzFtSGt49f6RPkPBis3Vo4PbS7roQEDn22hiHzl/Lo1q4i4hDEgBJmBF/NTNg2XR0HbFg==", + "version": "20.11.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz", + "integrity": "sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/package.json b/package.json index 292d183..21f1fbe 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@commitlint/config-conventional": "19.1.0", "@commitlint/types": "19.0.3", "@types/eslint": "8.56.5", - "@types/node": "20.11.27", + "@types/node": "20.11.28", "husky": "9.0.11", "lint-staged": "15.2.2", "prettier": "3.2.5", From ad9f1b30edc6236f7ec7649b0b251f735644e4dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 16 Mar 2024 00:55:39 +0100 Subject: [PATCH 5/9] chore(deps): bump eslint-plugin-react from 7.34.0 to 7.34.1 (#12) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) from 7.34.0 to 7.34.1.
Release notes

Sourced from eslint-plugin-react's releases.

v7.34.1

Fixed

Changed

  • [boolean-prop-naming]: improve error message (@​ljharb)

#1000: jsx-eslint/eslint-plugin-react#1000 #1002: jsx-eslint/eslint-plugin-react#1002 #1005: jsx-eslint/eslint-plugin-react#1005 #100: jsx-eslint/eslint-plugin-react#100 #1010: jsx-eslint/eslint-plugin-react#1010 #1013: jsx-eslint/eslint-plugin-react#1013 #1022: jsx-eslint/eslint-plugin-react#1022 #1029: jsx-eslint/eslint-plugin-react#1029 #102: jsx-eslint/eslint-plugin-react#102 #1034: jsx-eslint/eslint-plugin-react#1034 #1038: jsx-eslint/eslint-plugin-react#1038 #1041: jsx-eslint/eslint-plugin-react#1041 #1043: jsx-eslint/eslint-plugin-react#1043 #1046: jsx-eslint/eslint-plugin-react#1046 #1047: jsx-eslint/eslint-plugin-react#1047 #1050: jsx-eslint/eslint-plugin-react#1050 #1053: jsx-eslint/eslint-plugin-react#1053 #1057: jsx-eslint/eslint-plugin-react#1057 #105: jsx-eslint/eslint-plugin-react#105 #1061: jsx-eslint/eslint-plugin-react#1061 #1062: jsx-eslint/eslint-plugin-react#1062 #1070: jsx-eslint/eslint-plugin-react#1070 #1071: jsx-eslint/eslint-plugin-react#1071 #1073: jsx-eslint/eslint-plugin-react#1073 #1076: jsx-eslint/eslint-plugin-react#1076 #1079: jsx-eslint/eslint-plugin-react#1079 #1088: jsx-eslint/eslint-plugin-react#1088 #1098: jsx-eslint/eslint-plugin-react#1098 #1101: jsx-eslint/eslint-plugin-react#1101 #1103: jsx-eslint/eslint-plugin-react#1103 #110: jsx-eslint/eslint-plugin-react#110 #1116: jsx-eslint/eslint-plugin-react#1116 #1117: jsx-eslint/eslint-plugin-react#1117 #1119: jsx-eslint/eslint-plugin-react#1119 #1121: jsx-eslint/eslint-plugin-react#1121 #1122: jsx-eslint/eslint-plugin-react#1122 #1123: jsx-eslint/eslint-plugin-react#1123

... (truncated)

Changelog

Sourced from eslint-plugin-react's changelog.

7.34.1 - 2024.03.15

Fixed

Changed

  • [boolean-prop-naming]: improve error message (@​ljharb)

#3715: jsx-eslint/eslint-plugin-react#3715 #3713: jsx-eslint/eslint-plugin-react#3713 #3707: jsx-eslint/eslint-plugin-react#3707 #3705: jsx-eslint/eslint-plugin-react#3705 #3704: jsx-eslint/eslint-plugin-react#3704 #3701: jsx-eslint/eslint-plugin-react#3701 #3700: jsx-eslint/eslint-plugin-react#3700

Commits
  • eea45bf Update CHANGELOG and bump version
  • e4ecbcf [Fix] checked-requires-onchange-or-readonly: correct options that were beha...
  • 69de42e [Fix] no-unknown-property: only match data-* attributes containing -
  • da1013c [Docs] jsx-no-constructed-context-values: fix some typos
  • c3275a4 [Fix] no-unknown-property: support popover, popovertarget, `popovertarg...
  • a920463 [Fix] boolean-prop-naming: improve error message
  • 48291e8 [Fix] boolean-prop-naming: allow TSIntersectionType
  • 0abebc6 [Fix] boolean-prop-naming: literalType error fix
  • 901c794 [Fix] boolean-prop-naming: detect TS interfaces
  • 8c2bdb2 [actions] update workflows
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-plugin-react&package-manager=npm_and_yarn&previous-version=7.34.0&new-version=7.34.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index ff3c145..d6ecc20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "eslint-plugin-import": "2.29.1", "eslint-plugin-jsx-a11y": "6.8.0", "eslint-plugin-no-unsanitized": "4.0.2", - "eslint-plugin-react": "7.34.0", + "eslint-plugin-react": "7.34.1", "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-unicorn": "51.0.1", "eslint-plugin-xss": "0.1.12" @@ -3299,9 +3299,9 @@ } }, "node_modules/eslint-plugin-react": { - "version": "7.34.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.34.0.tgz", - "integrity": "sha512-MeVXdReleBTdkz/bvcQMSnCXGi+c9kvy51IpinjnJgutl3YTHWsDdke7Z1ufZpGfDG8xduBDKyjtB9JH1eBKIQ==", + "version": "7.34.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.34.1.tgz", + "integrity": "sha512-N97CxlouPT1AHt8Jn0mhhN2RrADlUAsk1/atcT2KyA/l9Q/E6ll7OIGwNumFmWfZ9skV3XXccYS19h80rHtgkw==", "dependencies": { "array-includes": "^3.1.7", "array.prototype.findlast": "^1.2.4", diff --git a/package.json b/package.json index 21f1fbe..f3d0195 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "eslint-plugin-import": "2.29.1", "eslint-plugin-jsx-a11y": "6.8.0", "eslint-plugin-no-unsanitized": "4.0.2", - "eslint-plugin-react": "7.34.0", + "eslint-plugin-react": "7.34.1", "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-unicorn": "51.0.1", "eslint-plugin-xss": "0.1.12" From 5bca4e1c43985fc01c820471585408e41fc74e1f Mon Sep 17 00:00:00 2001 From: capitnflam Date: Sat, 16 Mar 2024 01:35:29 +0100 Subject: [PATCH 6/9] feat: add eslint-plugin-sonarjs (#15) --- package-lock.json | 12 ++++++++++++ package.json | 1 + src/configs/recommended.ts | 1 + 3 files changed, 14 insertions(+) diff --git a/package-lock.json b/package-lock.json index d6ecc20..82a56a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "eslint-plugin-no-unsanitized": "4.0.2", "eslint-plugin-react": "7.34.1", "eslint-plugin-react-hooks": "4.6.0", + "eslint-plugin-sonarjs": "0.24.0", "eslint-plugin-unicorn": "51.0.1", "eslint-plugin-xss": "0.1.12" }, @@ -3375,6 +3376,17 @@ "semver": "bin/semver.js" } }, + "node_modules/eslint-plugin-sonarjs": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.24.0.tgz", + "integrity": "sha512-87zp50mbbNrSTuoEOebdRQBPa0mdejA5UEjyuScyIw8hEpEjfWP89Qhkq5xVZfVyVSRQKZc9alVm7yRKQvvUmg==", + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/eslint-plugin-unicorn": { "version": "51.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-51.0.1.tgz", diff --git a/package.json b/package.json index f3d0195..80b7f09 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "eslint-plugin-no-unsanitized": "4.0.2", "eslint-plugin-react": "7.34.1", "eslint-plugin-react-hooks": "4.6.0", + "eslint-plugin-sonarjs": "0.24.0", "eslint-plugin-unicorn": "51.0.1", "eslint-plugin-xss": "0.1.12" }, diff --git a/src/configs/recommended.ts b/src/configs/recommended.ts index 1d8e709..9181463 100644 --- a/src/configs/recommended.ts +++ b/src/configs/recommended.ts @@ -9,6 +9,7 @@ export const recommended: ESLintConfig = { 'plugin:import/recommended', 'plugin:import/typescript', 'plugin:unicorn/recommended', + 'plugin:sonarjs/recommended', 'prettier', ], parser: '@typescript-eslint/parser', From e7f8c2ed4e898774f94ab4d6c807960b0f542d10 Mon Sep 17 00:00:00 2001 From: capitnflam Date: Sat, 16 Mar 2024 01:40:14 +0100 Subject: [PATCH 7/9] feat: add eslint-plugin-security (#16) --- package-lock.json | 17 +++++++++++++++++ package.json | 1 + src/configs/recommended.ts | 1 + 3 files changed, 19 insertions(+) diff --git a/package-lock.json b/package-lock.json index 82a56a4..4f59ff5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "eslint-plugin-no-unsanitized": "4.0.2", "eslint-plugin-react": "7.34.1", "eslint-plugin-react-hooks": "4.6.0", + "eslint-plugin-security": "2.1.1", "eslint-plugin-sonarjs": "0.24.0", "eslint-plugin-unicorn": "51.0.1", "eslint-plugin-xss": "0.1.12" @@ -3376,6 +3377,14 @@ "semver": "bin/semver.js" } }, + "node_modules/eslint-plugin-security": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-2.1.1.tgz", + "integrity": "sha512-7cspIGj7WTfR3EhaILzAPcfCo5R9FbeWvbgsPYWivSurTBKW88VQxtP3c4aWMG9Hz/GfJlJVdXEJ3c8LqS+u2w==", + "dependencies": { + "safe-regex": "^2.1.1" + } + }, "node_modules/eslint-plugin-sonarjs": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.24.0.tgz", @@ -9926,6 +9935,14 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, + "node_modules/safe-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-2.1.1.tgz", + "integrity": "sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==", + "dependencies": { + "regexp-tree": "~0.1.1" + } + }, "node_modules/safe-regex-test": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", diff --git a/package.json b/package.json index 80b7f09..2113149 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "eslint-plugin-no-unsanitized": "4.0.2", "eslint-plugin-react": "7.34.1", "eslint-plugin-react-hooks": "4.6.0", + "eslint-plugin-security": "2.1.1", "eslint-plugin-sonarjs": "0.24.0", "eslint-plugin-unicorn": "51.0.1", "eslint-plugin-xss": "0.1.12" diff --git a/src/configs/recommended.ts b/src/configs/recommended.ts index 9181463..4ba1f67 100644 --- a/src/configs/recommended.ts +++ b/src/configs/recommended.ts @@ -10,6 +10,7 @@ export const recommended: ESLintConfig = { 'plugin:import/typescript', 'plugin:unicorn/recommended', 'plugin:sonarjs/recommended', + 'plugin:security/recommended-legacy', 'prettier', ], parser: '@typescript-eslint/parser', From fe2bf30b5f90914deacec90dba8f1b173cf5de60 Mon Sep 17 00:00:00 2001 From: capitnflam Date: Sat, 16 Mar 2024 01:45:34 +0100 Subject: [PATCH 8/9] feat: add @eslint-community/eslint-plugin-eslint-comments (#17) --- package-lock.json | 17 ++++++++++++++++- package.json | 1 + src/configs/recommended.ts | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 4f59ff5..b1fbd23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0-development", "license": "MIT", "dependencies": { + "@eslint-community/eslint-plugin-eslint-comments": "4.1.0", "@typescript-eslint/eslint-plugin": "7.2.0", "@typescript-eslint/parser": "7.2.0", "eslint-config-prettier": "9.1.0", @@ -484,6 +485,21 @@ "fast-check": "^3.13.2" } }, + "node_modules/@eslint-community/eslint-plugin-eslint-comments": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-4.1.0.tgz", + "integrity": "sha512-B2mwipifrBS5E00vN8vME68laPMZ0h3sNGOEDj5g9iUN9k5EU99Omq0Nc325eKNoFFDnDtiHp3DqIjO+1bstag==", + "dependencies": { + "escape-string-regexp": "^4.0.0", + "ignore": "^5.2.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -3085,7 +3101,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "peer": true, "engines": { "node": ">=10" }, diff --git a/package.json b/package.json index 2113149..79e8cbd 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "bugs": "https://github.com/capitnflam/eslint-plugin/issues", "dependencies": { + "@eslint-community/eslint-plugin-eslint-comments": "4.1.0", "@typescript-eslint/eslint-plugin": "7.2.0", "@typescript-eslint/parser": "7.2.0", "eslint-config-prettier": "9.1.0", diff --git a/src/configs/recommended.ts b/src/configs/recommended.ts index 4ba1f67..ef710e9 100644 --- a/src/configs/recommended.ts +++ b/src/configs/recommended.ts @@ -4,6 +4,7 @@ export const recommended: ESLintConfig = { plugins: ['@flaminc', '@typescript-eslint'], extends: [ 'eslint:recommended', + 'plugin:@eslint-community/eslint-comments/recommended', 'plugin:@typescript-eslint/recommended-type-checked', 'plugin:@typescript-eslint/stylistic-type-checked', 'plugin:import/recommended', From 203d603baa9563d6c958cc088ee11d6b2c36828c Mon Sep 17 00:00:00 2001 From: capitnflam Date: Sat, 16 Mar 2024 03:26:08 +0100 Subject: [PATCH 9/9] feat: add eslint-plugin-n (#18) --- package-lock.json | 78 +++++++++++++++++++++++++++++++++++++++++++- package.json | 1 + src/configs/node.ts | 6 ++++ src/configs/react.ts | 1 - src/index.ts | 2 ++ 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 src/configs/node.ts diff --git a/package-lock.json b/package-lock.json index b1fbd23..ade336a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.29.1", "eslint-plugin-jsx-a11y": "6.8.0", + "eslint-plugin-n": "16.6.2", "eslint-plugin-no-unsanitized": "4.0.2", "eslint-plugin-react": "7.34.1", "eslint-plugin-react-hooks": "4.6.0", @@ -2182,7 +2183,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", - "dev": true, "dependencies": { "semver": "^7.0.0" } @@ -3163,6 +3163,17 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-compat-utils": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/eslint-compat-utils/-/eslint-compat-utils-0.1.2.tgz", + "integrity": "sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==", + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, "node_modules/eslint-config-prettier": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", @@ -3216,6 +3227,25 @@ "ms": "^2.1.1" } }, + "node_modules/eslint-plugin-es-x": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.5.0.tgz", + "integrity": "sha512-ODswlDSO0HJDzXU0XvgZ3lF3lS3XAZEossh15Q2UHjwrJggWeBoKqqEsLTZLXl+dh5eOAozG0zRcYtuE35oTuQ==", + "dependencies": { + "@eslint-community/eslint-utils": "^4.1.2", + "@eslint-community/regexpp": "^4.6.0", + "eslint-compat-utils": "^0.1.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "eslint": ">=8" + } + }, "node_modules/eslint-plugin-import": { "version": "2.29.1", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", @@ -3307,6 +3337,33 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" }, + "node_modules/eslint-plugin-n": { + "version": "16.6.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.6.2.tgz", + "integrity": "sha512-6TyDmZ1HXoFQXnhCTUjVFULReoBPOAjpuiKELMkeP40yffI/1ZRO+d9ug/VC6fqISo2WkuIBk3cvuRPALaWlOQ==", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "builtins": "^5.0.1", + "eslint-plugin-es-x": "^7.5.0", + "get-tsconfig": "^4.7.0", + "globals": "^13.24.0", + "ignore": "^5.2.4", + "is-builtin-module": "^3.2.1", + "is-core-module": "^2.12.1", + "minimatch": "^3.1.2", + "resolve": "^1.22.2", + "semver": "^7.5.3" + }, + "engines": { + "node": ">=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-plugin-no-unsanitized": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-4.0.2.tgz", @@ -4182,6 +4239,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.3.tgz", + "integrity": "sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/git-log-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/git-log-parser/-/git-log-parser-1.2.0.tgz", @@ -9824,6 +9892,14 @@ "node": ">=8" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", diff --git a/package.json b/package.json index 79e8cbd..c448b27 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.29.1", "eslint-plugin-jsx-a11y": "6.8.0", + "eslint-plugin-n": "16.6.2", "eslint-plugin-no-unsanitized": "4.0.2", "eslint-plugin-react": "7.34.1", "eslint-plugin-react-hooks": "4.6.0", diff --git a/src/configs/node.ts b/src/configs/node.ts new file mode 100644 index 0000000..141dfb7 --- /dev/null +++ b/src/configs/node.ts @@ -0,0 +1,6 @@ +import { type ESLintConfig } from '../types' + +export const node: ESLintConfig = { + plugins: ['@flaminc'], + extends: ['plugin:n/recommended'], +} diff --git a/src/configs/react.ts b/src/configs/react.ts index 3beb944..78d4d51 100644 --- a/src/configs/react.ts +++ b/src/configs/react.ts @@ -3,7 +3,6 @@ import { type ESLintConfig } from '../types' export const react: ESLintConfig = { plugins: ['@flaminc'], extends: [ - 'plugin:@flaminc/recommended', 'plugin:react/recommended', 'plugin:react/jsx-runtime', 'plugin:react-hooks/recommended', diff --git a/src/index.ts b/src/index.ts index 251b685..4b91693 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,11 +2,13 @@ import { type ESLint } from 'eslint' import { name, version } from '../package.json' +import { node } from './configs/node' import { react } from './configs/react' import { recommended } from './configs/recommended' const plugin: ESLint.Plugin = { configs: { + node, react, recommended, },