Skip to content

Commit b25d749

Browse files
feat: support static analyzer with version 260.31.0
1 parent 37ec92c commit b25d749

File tree

8 files changed

+259
-267
lines changed

8 files changed

+259
-267
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,32 @@ ESLint version-specific configuration examples are provided below. Here are some
3333

3434
The default configurations are now in the flat config format supported by ESLint 9 and beyond. Here's how to include the `recommended` config in your flat config:
3535

36+
```javascript
37+
// eslint.config.js
38+
const { defineConfig } = require("eslint/config");
39+
const lwcGraphAnalyzerPlugin = require("@salesforce/eslint-plugin-lwc-graph-analyzer");
40+
41+
module.exports = defineConfig([
42+
{
43+
plugins: {
44+
"@salesforce/lwc-graph-analyzer": lwcGraphAnalyzerPlugin,
45+
},
46+
extends: [lwcGraphAnalyzerPlugin.configs.recommended],
47+
},
48+
]);
49+
```
50+
3651
```javascript
3752
// eslint.config.mjs
3853
import js from '@eslint/js';
3954
import lwcGraphAnalyzerPlugin from '@salesforce/eslint-plugin-lwc-graph-analyzer';
4055

4156
export default [
42-
{ plugins: { '@salesforce/lwc-graph-analyzer': lwcGraphAnalyzerPlugin } },
57+
{
58+
plugins: {
59+
'@salesforce/lwc-graph-analyzer': lwcGraphAnalyzerPlugin
60+
}
61+
},
4362
js.configs.recommended,
4463
lwcGraphAnalyzerPlugin.configs.recommended
4564
];

package.json

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,100 @@
11
{
2-
"name": "@salesforce/eslint-plugin-lwc-graph-analyzer",
3-
"version": "1.0.0",
4-
"description": "ESLint plugin to analyze data graph in a LWC component",
5-
"contributors": [
6-
{
7-
"name": "Andrew Huffman",
8-
"url": "https://github.com/AndrewHuffman"
2+
"name": "@salesforce/eslint-plugin-lwc-graph-analyzer",
3+
"version": "1.1.0",
4+
"description": "ESLint plugin to analyze data graph in a LWC component",
5+
"contributors": [
6+
{
7+
"name": "Andrew Huffman",
8+
"url": "https://github.com/AndrewHuffman"
9+
},
10+
{
11+
"name": "Kevin Hawkins",
12+
"url": "https://github.com/khawkins"
13+
},
14+
{
15+
"name": "Meisam Seyed Aliroteh",
16+
"url": "https://github.com/maliroteh-sf"
17+
},
18+
{
19+
"name": "Takashi Arai",
20+
"url": "https://github.com/sfdctaka"
21+
},
22+
{
23+
"name": "Dustin Breese",
24+
"url": "https://github.com/dbreese"
25+
}
26+
],
27+
"homepage": "https://github.com/salesforce/eslint-plugin-lwc-graph-analyzer",
28+
"license": "MIT",
29+
"repository": {
30+
"type": "git",
31+
"url": "https://github.com/salesforce/eslint-plugin-lwc-graph-analyzer.git"
932
},
10-
{
11-
"name": "Kevin Hawkins",
12-
"url": "https://github.com/khawkins"
33+
"main": "lib/index.js",
34+
"types": "lib/index.d.ts",
35+
"directories": {
36+
"lib": "lib",
37+
"rules": "lib/rules",
38+
"test": "test"
1339
},
14-
{
15-
"name": "Meisam Seyed Aliroteh",
16-
"url": "https://github.com/maliroteh-sf"
40+
"files": [
41+
"lib/**/*",
42+
"!**/test/**"
43+
],
44+
"devDependencies": {
45+
"@eslint/js": "^9.30.1",
46+
"@typescript-eslint/parser": "^8.35.1",
47+
"chai": "^4.5.0",
48+
"eslint": "^9.28.0",
49+
"eslint-plugin-eslint-plugin": "^6.5.0",
50+
"eslint-plugin-n": "^17.20.0",
51+
"husky": "^9.1.7",
52+
"jest": "^29.7.0",
53+
"jest-chain": "^1.1.6",
54+
"jest-extended": "^4.0.2",
55+
"jest-junit": "^16.0.0",
56+
"jest-sonar-reporter": "^2.0.0",
57+
"prettier": "^3.6.2",
58+
"typescript": "^5.8.3",
59+
"typescript-eslint": "^8.35.1"
1760
},
18-
{
19-
"name": "Takashi Arai",
20-
"url": "https://github.com/sfdctaka"
61+
"dependencies": {
62+
"@babel/core": "^7.28.0",
63+
"@babel/eslint-parser": "^7.28.0",
64+
"@komaci/static-analyzer": "^260.31.0",
65+
"@lwc/errors": "^8.21.1",
66+
"@lwc/metadata": "^12.0.0",
67+
"@lwc/sfdc-compiler-utils": "^12.0.0",
68+
"@lwc/template-compiler": "^8.21.1",
69+
"@types/eslint": "^9.6.1"
2170
},
22-
{
23-
"name": "Dustin Breese",
24-
"url": "https://github.com/dbreese"
71+
"scripts": {
72+
"format": "prettier --list-different \"**/*.js\"",
73+
"format:fix": "prettier --write \"**/*.{js,json}\"",
74+
"lint": "eslint",
75+
"test": "yarn jest --coverage",
76+
"prepare": "husky"
77+
},
78+
"jestSonar": {
79+
"sonar56x": true,
80+
"reportPath": "reports/coverage",
81+
"reportFile": "sonar-report.xml",
82+
"indent": 4
83+
},
84+
"prettier": {
85+
"printWidth": 100,
86+
"tabWidth": 4,
87+
"singleQuote": true,
88+
"trailingComma": "none"
89+
},
90+
"engines": {
91+
"node": ">=20"
92+
},
93+
"peerDependencies": {
94+
"eslint": ">=7"
95+
},
96+
"volta": {
97+
"node": "20.18.0",
98+
"yarn": "1.22.22"
2599
}
26-
],
27-
"homepage": "https://github.com/salesforce/eslint-plugin-lwc-graph-analyzer",
28-
"license": "MIT",
29-
"repository": {
30-
"type": "git",
31-
"url": "https://github.com/salesforce/eslint-plugin-lwc-graph-analyzer.git"
32-
},
33-
"main": "lib/index.js",
34-
"types": "lib/index.d.ts",
35-
"directories": {
36-
"lib": "lib",
37-
"rules": "lib/rules",
38-
"test": "test"
39-
},
40-
"files": [
41-
"lib/**/*",
42-
"!**/test/**"
43-
],
44-
"devDependencies": {
45-
"@eslint/js": "^9.30.1",
46-
"@typescript-eslint/parser": "^8.35.1",
47-
"chai": "^4.5.0",
48-
"eslint": "^9.28.0",
49-
"eslint-plugin-eslint-plugin": "^6.5.0",
50-
"eslint-plugin-n": "^17.20.0",
51-
"husky": "^9.1.7",
52-
"jest": "^29.7.0",
53-
"jest-chain": "^1.1.6",
54-
"jest-extended": "^4.0.2",
55-
"jest-junit": "^16.0.0",
56-
"jest-sonar-reporter": "^2.0.0",
57-
"prettier": "^3.6.2",
58-
"typescript": "^5.8.3",
59-
"typescript-eslint": "^8.35.1"
60-
},
61-
"dependencies": {
62-
"@babel/core": "^7.28.0",
63-
"@babel/eslint-parser": "^7.28.0",
64-
"@komaci/static-analyzer": "^252.1.0",
65-
"@lwc/errors": "~3.5.0",
66-
"@lwc/metadata": "3.5.0-0",
67-
"@lwc/sfdc-compiler-utils": "3.5.0-0",
68-
"@lwc/template-compiler": "~3.5.0",
69-
"@types/eslint": "^9.6.1"
70-
},
71-
"scripts": {
72-
"format": "prettier --list-different \"**/*.js\"",
73-
"format:fix": "prettier --write \"**/*.{js,json}\"",
74-
"lint": "eslint",
75-
"test": "yarn jest --coverage",
76-
"prepare": "husky"
77-
},
78-
"jestSonar": {
79-
"sonar56x": true,
80-
"reportPath": "reports/coverage",
81-
"reportFile": "sonar-report.xml",
82-
"indent": 4
83-
},
84-
"prettier": {
85-
"printWidth": 100,
86-
"tabWidth": 4,
87-
"singleQuote": true,
88-
"trailingComma": "none"
89-
},
90-
"engines": {
91-
"node": ">=20"
92-
},
93-
"peerDependencies": {
94-
"eslint": ">=7"
95-
},
96-
"volta": {
97-
"node": "20.18.0",
98-
"yarn": "1.22.22"
99-
}
100100
}
6 KB
Binary file not shown.

test/lib/rules/artifacts-combined-files/fileUpload/test.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default class FileUpload extends LightningElement {
2727

2828
/* eslint-disable */
2929
get fileName() {
30+
// This getter voilates the rule no-getter-contains-more-than-return-statement since it is referenced in the template html
3031
const file = this.files && this.files[0];
3132
if (file) {
3233
return file.name;
@@ -35,17 +36,16 @@ export default class FileUpload extends LightningElement {
3536
}
3637
/* eslint-enable */
3738

38-
/* eslint-disable @salesforce/lwc-graph-analyzer/no-getter-contains-more-than-return-statement */
39+
// No longer voilating the rule no-getter-contains-more-than-return-statement
3940
get fileName1() {
4041
const file = this.files && this.files[0];
4142
if (file) {
4243
return file.name;
4344
}
4445
return undefined;
4546
}
46-
/* eslint-enable @salesforce/lwc-graph-analyzer/no-getter-contains-more-than-return-statement */
4747

48-
// eslint-disable-next-line
48+
// No longer voilating the rule no-getter-contains-more-than-return-statement
4949
get fileName2() {
5050
const file = this.files && this.files[0];
5151
if (file) {
@@ -54,7 +54,7 @@ export default class FileUpload extends LightningElement {
5454
return undefined;
5555
}
5656

57-
// eslint-disable-next-line @salesforce/lwc-graph-analyzer/no-getter-contains-more-than-return-statement
57+
// No longer voilating the rule no-getter-contains-more-than-return-statement
5858
get fileName3() {
5959
const file = this.files && this.files[0];
6060
if (file) {
@@ -64,7 +64,8 @@ export default class FileUpload extends LightningElement {
6464
}
6565

6666
// prettier-ignore
67-
get fileName4() { // eslint-disable-line
67+
// No longer voilating the rule no-getter-contains-more-than-return-statement
68+
get fileName4() {
6869
const file = this.files && this.files[0];
6970
if (file) {
7071
return file.name;
@@ -73,7 +74,7 @@ export default class FileUpload extends LightningElement {
7374
}
7475

7576
// prettier-ignore
76-
get fileName5() { // eslint-disable-line @salesforce/lwc-graph-analyzer/no-getter-contains-more-than-return-statement
77+
get fileName5() {
7778
const file = this.files && this.files[0];
7879
if (file) {
7980
return file.name;

test/lib/rules/artifacts-combined-files/helper.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ function lintBundle(rulePath, target) {
5454
const srcCode = readFileSync(testPath).toString();
5555

5656
const linter = new Linter();
57-
return linter.verify(srcCode, config, { filename: testPath, filterCodeBlock });
57+
return linter.verify(srcCode, config, {
58+
filename: testPath,
59+
filterCodeBlock,
60+
reportUnusedDisableDirectives: false
61+
});
5862
}
5963

6064
/**
@@ -76,7 +80,8 @@ function lintProgrammaticBundle(rulePath, target) {
7680
const linter = new Linter();
7781
return linter.verify(srcCode, config, {
7882
filename: testPath,
79-
filterCodeBlock
83+
filterCodeBlock,
84+
reportUnusedDisableDirectives: false
8085
});
8186
}
8287

test/lib/rules/no-expression-contains-module-level-variable-ref.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ ruleTester.run(
3636
testFunction(val){
3737
return val;
3838
}
39+
40+
@wire(findContacts, { searchKey: '$searchKey' })
41+
contacts;
3942
}`,
4043
filename: 'lwc-code.js',
4144
errors: [

test/lib/rules/no-getter-contains-more-than-return-statement.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ ruleTester.run(
3636
}
3737
3838
@wire(getRecord, { recordId: '$config' })
39-
record(value) {
40-
console.log(value);
41-
}
39+
record1;
4240
4341
@wire(getRecord, { recordId: '$myObjLiteral.prop2' })
4442
record2;

0 commit comments

Comments
 (0)