Skip to content

Commit a0fbef4

Browse files
Change notice behavior for trailing-comma esSpecCompliant (#323)
* Change notice behavior for trailing-comma esSpecCompliant eslint only supports esSpecCompliant true. * trailing-comma: Default to esSpecCompliant true Only warn when esSpecCompliant is specifically set to false and assume true since it's the desired behavior.
1 parent ea960c7 commit a0fbef4

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/rules/converters/tests/trailing-comma.test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ describe(convertTrailingComma, () => {
272272
esSpecCompliant: true,
273273
},
274274
expectedRuleArguments: [],
275-
expectedNotices: ["ESLint does not support config property esSpecCompliant"],
276275
},
277276
{
278277
argument: {
@@ -300,10 +299,7 @@ describe(convertTrailingComma, () => {
300299
},
301300
},
302301
expectedRuleArguments: [{}],
303-
expectedNotices: [
304-
"ESLint does not support config property esSpecCompliant",
305-
"ESLint does not support config property typeLiterals",
306-
],
302+
expectedNotices: ["ESLint does not support config property typeLiterals"],
307303
},
308304
{
309305
argument: {
@@ -314,7 +310,7 @@ describe(convertTrailingComma, () => {
314310
},
315311
expectedRuleArguments: [{}],
316312
expectedNotices: [
317-
"ESLint does not support config property esSpecCompliant",
313+
"ESLint only supports esSpecCompliant enabled",
318314
"ESLint does not support config property typeLiterals",
319315
],
320316
},
@@ -330,7 +326,7 @@ describe(convertTrailingComma, () => {
330326
},
331327
expectedRuleArguments: [{}],
332328
expectedNotices: [
333-
"ESLint does not support config property esSpecCompliant",
329+
"ESLint only supports esSpecCompliant enabled",
334330
"ESLint does not support config property typeLiterals",
335331
],
336332
},

src/rules/converters/trailing-comma.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,8 @@ function collectNotices(args: TSLintArg[]): string[] {
125125
}
126126

127127
function buildNoticeForEsSpecCompliant(arg: TSLintArg): string {
128-
const unsupportedConfigKey = "esSpecCompliant";
129-
130-
if (Object.keys(arg).includes(unsupportedConfigKey)) {
131-
return `ESLint does not support config property ${unsupportedConfigKey}`;
128+
if (arg.esSpecCompliant === false) {
129+
return `ESLint only supports esSpecCompliant enabled`;
132130
}
133131

134132
return "";

0 commit comments

Comments
 (0)