-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove deprecated rules (#522)
- Loading branch information
1 parent
5f7e583
commit 7b9cc9d
Showing
6 changed files
with
53 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const { EOL } = require("os"); | ||
const test = require("tape"); | ||
const { $, lintConfigFiles } = require("./helper"); | ||
|
||
const checkRules = (file, option, env = {}) => { | ||
try { | ||
$("eslint-find-rules", option, file, { env }); | ||
} catch (err) { | ||
const { stdout, stderr } = err; | ||
if (typeof stdout === "string" && stdout !== "") { | ||
process.stderr.write(stdout + EOL); | ||
} | ||
if (typeof stderr === "string" && stderr !== "") { | ||
process.stderr.write(stderr + EOL); | ||
} | ||
throw err; | ||
} | ||
}; | ||
|
||
test("no unused rules", t => { | ||
lintConfigFiles.forEach(file => { | ||
checkRules(file, "--unused"); | ||
t.pass(file); | ||
}); | ||
t.end(); | ||
}); | ||
|
||
test("deprecated rules", t => { | ||
lintConfigFiles.forEach(file => { | ||
try { | ||
checkRules(file, "--deprecated", { ESLINT_CONFIG_PRETTIER_NO_DEPRECATED: "true" }); | ||
} catch (err) { | ||
if (typeof err.stdout === "string" && err.stdout.includes("jsx-a11y/label-has-for")) { | ||
[ | ||
"", | ||
"NOTE: `jsx-a11y/label-has-for` rule is deprecated but included in the recommended config.", | ||
"", | ||
"See https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md", | ||
"", | ||
].forEach(line => process.stdout.write(line + EOL)); | ||
} else { | ||
throw err; | ||
} | ||
} | ||
t.pass(file); | ||
}); | ||
t.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.