Skip to content

Change notice behavior for trailing-comma esSpecCompliant #323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/rules/converters/tests/trailing-comma.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ describe(convertTrailingComma, () => {
esSpecCompliant: true,
},
expectedRuleArguments: [],
expectedNotices: ["ESLint does not support config property esSpecCompliant"],
},
{
argument: {
Expand Down Expand Up @@ -300,10 +299,7 @@ describe(convertTrailingComma, () => {
},
},
expectedRuleArguments: [{}],
expectedNotices: [
"ESLint does not support config property esSpecCompliant",
"ESLint does not support config property typeLiterals",
],
expectedNotices: ["ESLint does not support config property typeLiterals"],
},
{
argument: {
Expand All @@ -314,7 +310,7 @@ describe(convertTrailingComma, () => {
},
expectedRuleArguments: [{}],
expectedNotices: [
"ESLint does not support config property esSpecCompliant",
"ESLint only supports esSpecCompliant enabled",
"ESLint does not support config property typeLiterals",
],
},
Expand All @@ -330,7 +326,7 @@ describe(convertTrailingComma, () => {
},
expectedRuleArguments: [{}],
expectedNotices: [
"ESLint does not support config property esSpecCompliant",
"ESLint only supports esSpecCompliant enabled",
"ESLint does not support config property typeLiterals",
],
},
Expand Down
6 changes: 2 additions & 4 deletions src/rules/converters/trailing-comma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ function collectNotices(args: TSLintArg[]): string[] {
}

function buildNoticeForEsSpecCompliant(arg: TSLintArg): string {
const unsupportedConfigKey = "esSpecCompliant";

if (Object.keys(arg).includes(unsupportedConfigKey)) {
return `ESLint does not support config property ${unsupportedConfigKey}`;
if (arg.esSpecCompliant === false) {
return `ESLint only supports esSpecCompliant enabled`;
}

return "";
Expand Down