Skip to content

Commit d471b56

Browse files
authored
fix: add newer-version-available to the recommended list (#162)
1 parent 0831b8d commit d471b56

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"semver": "^7.6.2"
2929
},
3030
"devDependencies": {
31-
"@lwc/eslint-plugin-lwc": "^3.0.0",
31+
"@lwc/eslint-plugin-lwc": "^3.3.0",
3232
"@salesforce/eslint-plugin-lightning": "^2.0.0",
3333
"eslint": "^9.17.0",
3434
"eslint-plugin-import": "^2.31.0",

recommended.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ module.exports = [
124124
},
125125
],
126126
'@lwc/lwc/valid-graphql-wire-adapter-callback-parameters': 'error',
127+
'@lwc/lwc/newer-version-available': 'error',
127128

128129
// Lightning
129130
'@salesforce/lightning/valid-apex-method-invocation': 'error',

test/recommended.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ describe('recommended config', () => {
158158

159159
const results = await cli.lintText(`
160160
import { wire } from 'lwc';
161-
import { gql, graphql } from 'lightning/uiGraphQLApi';
161+
import { gql, graphql } from 'lightning/graphql';
162162
163163
class Test {
164164
@wire(graphql, {})
@@ -172,6 +172,23 @@ describe('recommended config', () => {
172172
'@lwc/lwc/valid-graphql-wire-adapter-callback-parameters',
173173
);
174174
});
175+
176+
it('should suggest upgrading to new versions of libraries', async () => {
177+
const cli = getCliEngineWithRecommendedRules();
178+
179+
const results = await cli.lintText(`
180+
import { wire } from 'lwc';
181+
import { gql, graphql } from 'lightning/uiGraphQLApi';
182+
183+
class Test {
184+
@wire(graphql, {})
185+
wiredMethod({errors, data}) {}
186+
}`);
187+
188+
const { messages } = results[0];
189+
assert.strictEqual(messages.length, 5);
190+
assert.strictEqual(messages[0].ruleId, '@lwc/lwc/newer-version-available');
191+
});
175192
});
176193

177194
describe('typescript recommended config', () => {
@@ -310,7 +327,7 @@ describe('typescript recommended config', () => {
310327

311328
const results = await cli.lintText(`
312329
import { wire } from 'lwc';
313-
import { gql, graphql } from 'lightning/uiGraphQLApi';
330+
import { gql, graphql } from 'lightning/graphql';
314331
315332
class Test {
316333
@wire(graphql, {})

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@
297297
"@jridgewell/resolve-uri" "^3.1.0"
298298
"@jridgewell/sourcemap-codec" "^1.4.14"
299299

300-
"@lwc/eslint-plugin-lwc@^3.0.0":
301-
version "3.0.0"
302-
resolved "https://registry.yarnpkg.com/@lwc/eslint-plugin-lwc/-/eslint-plugin-lwc-3.0.0.tgz#df5168cb951540ad41750cccfec06a047a2062bd"
303-
integrity sha512-98Z9Jo/w/g5rvaCwW53MooEozle+Cz8ixSpdGS3ndcU3pxWPMuexzrkbEtWny3YKYR6tKw9QXlaDL8hexE4zMA==
300+
"@lwc/eslint-plugin-lwc@^3.3.0":
301+
version "3.3.0"
302+
resolved "https://registry.yarnpkg.com/@lwc/eslint-plugin-lwc/-/eslint-plugin-lwc-3.3.0.tgz#6b1b955579797e0989304da9f875aa9f6118b54a"
303+
integrity sha512-qTcRGGTdBAfuPlJTL2sTk65skQHqnthz8TRx/1IasFZb+aljSn+CamnaPyzq8s2xAzQsS+NZJQoWlrZjyzzCzw==
304304
dependencies:
305305
fast-xml-parser "^4.5.1"
306306
globals "~15.14.0"

0 commit comments

Comments
 (0)