Skip to content

Commit

Permalink
feat!: bump SonarJS and related dependencies (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin authored Dec 27, 2023
1 parent 57523f7 commit 9dc4bfe
Show file tree
Hide file tree
Showing 20 changed files with 5,788 additions and 4,512 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-bees-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-sonar": minor
---

feat!: bump SonarJS and related dependencies
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"node": "16",
"node": "18",
"installCommand": "codesandbox:install",
"packages": [
"eslint-plugin-sonar"
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ coverage
lib
node_modules
/SonarJS
/test.*
test/fixtures
CHANGELOG.md
!/.github
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@ jobs:
node:
- 16
- 18
- 20
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: yarn

- name: Install Dependencies
run: yarn --frozen-lockfile
run: yarn --frozen-lockfile --ignore-engines

- name: Build, Lint and Test
run: |
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: 'CodeQL'
name: CodeQL

on:
push:
branches: ['main']
branches:
- main
pull_request:
branches: ['main']
branches:
- main
schedule:
- cron: '2 20 * * 4'

Expand All @@ -20,11 +22,12 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [javascript]
language:
- javascript

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
submodules: true

- name: Setup Node.js 16
uses: actions/setup-node@v3
- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
node-version: 16
node-version: lts/*
cache: yarn

- name: Install Dependencies
run: yarn --frozen-lockfile

- name: Build
run: yarn build

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.type-coverage
node_modules
/eslint-plugin-sonar/lib
/test.*
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "SonarJS"]
path = SonarJS
url = https:/SonarSource/SonarJS.git
url = https:/un-ts/SonarJS.git
516 changes: 285 additions & 231 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion SonarJS
Submodule SonarJS updated 10664 files
516 changes: 285 additions & 231 deletions eslint-plugin-sonar/README.md

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions eslint-plugin-sonar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@
"typescript": "^4.0.0 || ^5.0.0"
},
"dependencies": {
"@babel/eslint-parser": "^7.22.5",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@babel/eslint-parser": "^7.23.3",
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"builtin-modules": "^3.3.0",
"bytes": "^3.1.2",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-sonarjs": "^0.19.0",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.2.0",
"scslre": "^0.2.0",
"jsx-ast-utils": "^3.3.5",
"minimatch": "^9.0.3",
"scslre": "^0.3.0",
"tmp": "^0.2.1"
},
"publishConfig": {
Expand Down
2 changes: 0 additions & 2 deletions eslint-plugin-sonar/src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const base: Linter.Config = {
'sonar/no-invalid-await': 2,
'sonar/no-labels': 1,
// 'sonar/no-misleading-array-reverse': 1,
'sonar/no-new-symbol': 2,
'sonar/no-parameter-reassignment': 1,
'sonar/no-primitive-wrappers': 1,
'sonar/no-redundant-assignments': 1,
Expand Down Expand Up @@ -78,7 +77,6 @@ export const base: Linter.Config = {
'sonar/no-gratuitous-expressions': 0,
'sonar/no-implicit-global': 0,
'sonar/no-invalid-await': 0,
'sonar/no-new-symbol': 0,
'sonar/no-primitive-wrappers': 0,
'sonar/operation-returning-nan': 0,
'sonar/sonar-block-scoped-var': 0,
Expand Down
4 changes: 2 additions & 2 deletions eslint-plugin-sonar/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * as configs from './configs'
export * from 'sonarjs/rules'
export * as configs from './configs.js'
export * from 'sonarjs/rules/index.js'
69 changes: 27 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "eslint-sonarjs",
"version": "0.0.0",
"type": "module",
"repository": "git+https:/un-ts/eslint-plugin-sonar.git",
"author": "JounQin <[email protected]>",
"license": "MIT",
Expand All @@ -9,70 +10,54 @@
"SonarJS",
"eslint-plugin-sonar"
],
"packageManager": "[email protected].19",
"packageManager": "[email protected].21",
"scripts": {
"build": "run-s build:lib build:readme",
"build:lib": "rollup -c",
"build:readme": "ts-node scripts/readme",
"build:readme": "tsx scripts/readme",
"clean": "rimraf eslint-plugin-sonar/lib",
"codesandbox:install": "git submodule update --init && yarn",
"lint": "run-p lint:*",
"lint:es": "eslint . --cache --max-warnings 10 -f friendly",
"lint:tsc": "tsc --noEmit",
"prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"prerelease": "ts-node scripts/private",
"release": "changeset publish",
"test": "jest",
"prepare": "patch-package && simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"release": "yarn build && tsx scripts/private &&& changeset publish",
"typecov": "type-coverage"
},
"devDependencies": {
"@1stg/common-config": "^8.1.0",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.1",
"@rollup/plugin-alias": "^5.0.0",
"rollup": "^3.25.1",
"rollup-plugin-ts": "^3.2.0",
"ts-node": "^10.9.1",
"type-coverage": "^2.26.0",
"@1stg/common-config": "^9.0.1",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@rollup/plugin-alias": "^5.1.0",
"@types/prettier": "^2.7.3",
"patch-package": "^8.0.0",
"rollup": "^4.9.1",
"rollup-plugin-ts": "^3.4.5",
"tsx": "^4.7.0",
"type-coverage": "^2.27.1",
"yarn-deduplicate": "^6.0.2"
},
"resolutions": {
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/experimental-utils": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"@typescript-eslint/scope-manager": "^5.60.0",
"@typescript-eslint/type-utils": "^5.60.0",
"@typescript-eslint/utils": "^5.60.0",
"eslint": "^8.43.0",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/experimental-utils": "^5.62.0",
"@typescript-eslint/parser": "^6.16.0",
"@typescript-eslint/scope-manager": "^6.16.0",
"@typescript-eslint/type-utils": "^6.16.0",
"@typescript-eslint/utils": "^6.16.0",
"eslint": "^8.56.0",
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
"eslint-plugin-sonar": "link:eslint-plugin-sonar",
"eslint-plugin-sonarjs": "^0.19.0",
"prettier": "^2.8.8"
},
"jest": {
"preset": "ts-jest",
"roots": [
"<rootDir>/eslint-plugin-sonar"
],
"moduleNameMapper": {
"^eslint-plugin-sonar$": "<rootDir>/eslint-plugin-sonar/src",
"^errors$": "<rootDir>/SonarJS/src/errors",
"^helpers$": "<rootDir>/SonarJS/src/helpers",
"^helpers/(.*)$": "<rootDir>/SonarJS/src/helpers/$1",
"^linting/(.*)$": "<rootDir>/SonarJS/src/linting/$1",
"^parsing/(.*)$": "<rootDir>/SonarJS/src/parsing/$1",
"^routing$": "<rootDir>/SonarJS/src/routing",
"^routing/(.*)$": "<rootDir>/SonarJS/src/routing/$1",
"^services/(.*)$": "<rootDir>/SonarJS/src/services/$1",
"^sonarjs/(.*)$": "<rootDir>/SonarJS/src/linting/eslint/$1"
}
"eslint-plugin-sonarjs": "^0.23.0",
"prettier": "^2.8.8",
"tmp": "^0.2.1"
},
"typeCoverage": {
"atLeast": 100,
"cache": true,
"detail": true,
"ignoreCatch": true,
"ignoreFiles": [
"SonarJS/**/*.ts"
"SonarJS/**/*"
],
"ignoreNonNullAssertion": true,
"strict": true,
Expand Down
13 changes: 13 additions & 0 deletions patches/@1stg+eslint-config+7.0.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@1stg/eslint-config/overrides.js b/node_modules/@1stg/eslint-config/overrides.js
index 3c54ff2..f0ab45c 100644
--- a/node_modules/@1stg/eslint-config/overrides.js
+++ b/node_modules/@1stg/eslint-config/overrides.js
@@ -172,7 +172,7 @@ const tsBase = {
'@typescript-eslint/prefer-for-of': 2,
'@typescript-eslint/prefer-function-type': 2,
'@typescript-eslint/prefer-ts-expect-error': 2,
- '@typescript-eslint/sort-type-union-intersection-members': 2,
+ '@typescript-eslint/sort-type-union-intersection-members': 0,
'@typescript-eslint/triple-slash-reference': [
2,
{
4 changes: 3 additions & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ const configs = /** @type {const} */ (['cjs', 'esm']).map(format => ({
format,
'fs/promises',
'errors',
'eslint-plugin-import',
'lodash.clone',
'process',
'util',
'vue-eslint-parser',
'@typescript-eslint/parser',
).replace(/(["'])(eslint-plugin-sonarjs\/[^"']+)\1/g, '$1$2.js$1')
).replaceAll(/(["'])(eslint-plugin-sonarjs\/[^"']+)\1/g, '$1$2.js$1')
}
},
},
Expand Down
17 changes: 12 additions & 5 deletions scripts/readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ import { rules } from 'eslint-plugin-sonar'

const wrapLink = (link?: string) => (link ? `<${link}>` : 'N/A')

const rulesFileContent = fs.readFileSync(
'SonarJS/packages/jsts/src/rules/index.ts',
'utf8',
)

const getRuleDetailLink = (rule: string) => {
const matched =
/https:\/\/sonarsource\.github\.io\/rspec\/#\/rspec\/S\d+\/javascript/.exec(
fs.readFileSync(`SonarJS/src/linting/eslint/rules/${rule}.ts`, 'utf8'),
)
return matched?.[0]
const matched = new RegExp(`rules\\['${rule}'\\] = (S\\d+)`).exec(
rulesFileContent,
)
if (!matched) {
return
}
return `https://sonarsource.github.io/rspec/#/rspec/${matched[1]}/javascript`
}

const ruleNames = Object.keys(rules)
Expand Down
32 changes: 15 additions & 17 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
{
"extends": "@1stg/tsconfig/node",
"extends": "@1stg/tsconfig/nodenext",
"compilerOptions": {
"paths": {
"eslint-plugin-sonar": ["./eslint-plugin-sonar/src"],
"errors": ["./SonarJS/src/errors"],
"helpers": ["./SonarJS/src/helpers"],
"helpers/*": ["./SonarJS/src/helpers/*"],
"linting/*": ["./SonarJS/src/linting/*"],
"parsing/*": ["./SonarJS/src/parsing/*"],
"routing": ["./SonarJS/src/routing"],
"routing/*": ["./SonarJS/src/routing/*"],
"services/*": ["./SonarJS/src/services/*"],
"sonarjs/*": ["./SonarJS/src/linting/eslint/*"]
"@sonar/jsts": ["./SonarJS/packages/jsts/src/index.ts"],
"@sonar/shared": ["./SonarJS/packages/shared/src/index.ts"],
"jsts/src/monitoring": [
"./SonarJS/packages/jsts/src/monitoring/index.ts"
],
"sonarjs/*": ["./SonarJS/packages/jsts/src/*"]
},
"target": "ES2018",
"useUnknownInCatchVariables": false
},
"include": [
"eslint-plugin-sonar",
"scripts",
"SonarJS/src",
"SonarJS/packages/jsts/src/rules",
"SonarJS/packages/shared/src",
"SonarJS/typings"
],
"exclude": [
"eslint-plugin-sonar/test/fixtures",
"SonarJS/src/linting/stylelint",
"SonarJS/packages/**/*.fixture.*",
"SonarJS/packages/**/*.test.*",
"SonarJS/packages/**/fixtures",
"SonarJS/packages/**/tests",
"SonarJS/packages/jsts/src/rules/tools",
"node_modules"
],
"ts-node": {
"transpileOnly": true
}
]
}
Loading

0 comments on commit 9dc4bfe

Please sign in to comment.