Skip to content

Commit 3435d42

Browse files
vdieznanpxclaudegithub-actions[bot]
authored
JS-1335 feat: add ESLint v10 support; remove code-eval, enforce-trailing-comma, super-invocation from eslint-plugin-sonarjs (#6401)
Co-authored-by: Matt Wilcox <nanpx@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 43692fc commit 3435d42

46 files changed

Lines changed: 899 additions & 207 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/renovate.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"**/fixtures/**",
1414
"packages/jsts/src/rules/**",
1515
"its/eslint8-plugin-sonarjs/**",
16-
"its/eslint9-plugin-sonarjs/**"
16+
"its/eslint9-plugin-sonarjs/**",
17+
"its/eslint10-plugin-sonarjs/**"
1718
],
1819
"packageRules": [
1920
{

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ jobs:
274274
strategy:
275275
matrix:
276276
include:
277+
- eslint-version: 10
278+
node-version: '20.19.0'
279+
node-label: 'min supported'
277280
- eslint-version: 9
278281
node-version: '18.18.0'
279282
node-label: 'min supported'

.gitignore

Lines changed: 65 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,65 @@
1-
# Maven
2-
target/
3-
bin/
4-
.flattened-pom.xml
5-
6-
lib/
7-
node_modules/
8-
coverage/
9-
10-
packages/jsts/src/rules/*/generated-meta.ts
11-
packages/grpc/src/proto/*.js
12-
packages/grpc/src/proto/*.d.ts
13-
sonarjs-1.0.0.tgz
14-
15-
# IntelliJ IDEA
16-
*.iws
17-
*.iml
18-
*.ipr
19-
.idea/
20-
21-
# Eclipse
22-
.classpath
23-
.project
24-
.settings
25-
26-
# Visual Studio
27-
.vs/
28-
29-
# VS Code
30-
.vscode/
31-
32-
# ---- Mac OS X
33-
.DS_Store
34-
Icon?
35-
# Thumbnails
36-
._*
37-
# Files that might appear on external disk
38-
.Spotlight-V100
39-
.Trashes
40-
41-
# ---- Windows
42-
# Windows image file caches
43-
Thumbs.db
44-
# Folder config file
45-
Desktop.ini
46-
47-
# ---- Sonar
48-
.sonar
49-
.scannerwork
50-
51-
# eslint-plugin-sonarjs
52-
eslint-plugin-sonarjs-*.tgz
53-
its/eslint8-plugin-sonarjs/package-lock.json
54-
its/eslint9-plugin-sonarjs/package-lock.json
55-
56-
/resources
57-
node-info.properties
58-
59-
# coverage
60-
.nyc_output/
61-
lcov.info
62-
63-
.claude/*
64-
!.claude/*.md
1+
# Maven
2+
target/
3+
bin/
4+
.flattened-pom.xml
5+
6+
lib/
7+
node_modules/
8+
coverage/
9+
10+
packages/jsts/src/rules/*/generated-meta.ts
11+
packages/grpc/src/proto/*.js
12+
packages/grpc/src/proto/*.d.ts
13+
sonarjs-1.0.0.tgz
14+
15+
# IntelliJ IDEA
16+
*.iws
17+
*.iml
18+
*.ipr
19+
.idea/
20+
21+
# Eclipse
22+
.classpath
23+
.project
24+
.settings
25+
26+
# Visual Studio
27+
.vs/
28+
29+
# VS Code
30+
.vscode/
31+
32+
# ---- Mac OS X
33+
.DS_Store
34+
Icon?
35+
# Thumbnails
36+
._*
37+
# Files that might appear on external disk
38+
.Spotlight-V100
39+
.Trashes
40+
41+
# ---- Windows
42+
# Windows image file caches
43+
Thumbs.db
44+
# Folder config file
45+
Desktop.ini
46+
47+
# ---- Sonar
48+
.sonar
49+
.scannerwork
50+
51+
# eslint-plugin-sonarjs
52+
eslint-plugin-sonarjs-*.tgz
53+
its/eslint8-plugin-sonarjs/package-lock.json
54+
its/eslint9-plugin-sonarjs/package-lock.json
55+
its/eslint10-plugin-sonarjs/package-lock.json
56+
57+
/resources
58+
node-info.properties
59+
60+
# coverage
61+
.nyc_output/
62+
lcov.info
63+
64+
.claude/*
65+
!.claude/*.md

.pmgrc.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[data]
2+
name = "eslint-plugin-sonarjs"
3+
description = "SonarJS rules for ESLint"
4+
version = "0.0.0-SNAPSHOT"
5+
main = "./cjs/plugin.js"
6+
types = "./types/plugin.d.ts"
7+
author = "SonarSource"
8+
license = "LGPL-3.0-only"
9+
keywords = ["sonarjs", "eslint", "eslintplugin"]
10+
homepage = "https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md"
11+
12+
[data.repository]
13+
type = "git"
14+
url = "git+https://github.com/SonarSource/SonarJS.git"
15+
16+
[data.bugs]
17+
url = "https://community.sonarsource.com/"
18+
19+
[data.peerDependencies]
20+
eslint = "^8.0.0 || ^9.0.0 || ^10.0.0"
21+
22+
# Version overrides: pmg auto-detects which deps are used, but these two need
23+
# non-default versions. `builtin-modules` is pinned to 3.3.0 (last CJS-compatible
24+
# release) because the plugin is compiled to CommonJS; the root package.json has
25+
# 5.0.0 (ESM-only) for the bridge. `typescript` is loosened to >=5 so consumers
26+
# aren't forced onto the exact version used to build.
27+
[data.dependencies]
28+
typescript = ">=5"
29+
builtin-modules = "3.3.0"

generate-eslint-package-json.mjs

Lines changed: 0 additions & 91 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* SonarQube JavaScript Plugin
3+
* Copyright (C) 2011-2025 SonarSource Sàrl
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
* See the Sonar Source-Available License for more details.
13+
*
14+
* You should have received a copy of the Sonar Source-Available License
15+
* along with this program; if not, see https://sonarsource.com/license/ssal/
16+
*/
17+
const plugin = require('eslint-plugin-sonarjs');
18+
19+
console.log(`Loaded ${Object.keys(plugin.configs.recommended.rules).length} rules`);
20+
21+
module.exports = [
22+
{
23+
files: ['./*.js'],
24+
languageOptions: { sourceType: 'commonjs' },
25+
},
26+
plugin.configs.recommended,
27+
{
28+
rules: {
29+
'sonarjs/no-implicit-dependencies': 'error',
30+
},
31+
},
32+
];
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* SonarQube JavaScript Plugin
3+
* Copyright (C) 2011-2025 SonarSource Sàrl
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
* See the Sonar Source-Available License for more details.
13+
*
14+
* You should have received a copy of the Sonar Source-Available License
15+
* along with this program; if not, see https://sonarsource.com/license/ssal/
16+
*/
17+
import plugin from 'eslint-plugin-sonarjs';
18+
19+
console.log(`Loaded ${Object.keys(plugin.configs.recommended.rules).length} rules`);
20+
21+
export default [
22+
{
23+
files: ['./*.js'],
24+
languageOptions: { sourceType: 'commonjs' },
25+
},
26+
plugin.configs.recommended,
27+
{
28+
rules: {
29+
'sonarjs/no-implicit-dependencies': 'error',
30+
},
31+
},
32+
];

0 commit comments

Comments
 (0)