ESLint plugin
This project is maintained by iliubinskii
A collection of ESLint rules for JavaScript and TypeScript files.
npm install --save-dev eslint-plugin-misc
// .eslintrc.js
module.exports = {
extends: "plugin:misc/all",
parser: "@typescript-eslint/parser",
plugins: ["misc"]
};
You can use the same rule several times by adding synonym:
// .eslintrc.synonyms.cjs
module.exports = ["misc/wrap/class-methods-use-this", "misc/wrap/no-shadow"];
// .eslintrc.js
module.exports = {
rules: {
// Same as ESLint core rule, but suppresses warnings for methods that have "this" parameter.
"misc/wrap/class-methods-use-this": [
"error",
{
plugin: "eslint",
rule: "class-methods-use-this",
skip: "FunctionExpression[params.0.name=this]"
}
],
// Same as typescript-eslint rule, but suppresses warnings for enums.
"misc/wrap/no-shadow": [
"error",
{
plugin: "@typescript-eslint/eslint-plugin",
rule: "no-shadow",
skip: "TSEnumDeclaration *"
}
]
}
};
Many custom checks can be created without writing full-fledged ESLint plugin. Use the rules below to create custom checks or adapt existing third-party rules:
If you want to apply one rule several times (e.g. restrict several syntaxes), use rule synonyms.
x && y
or !x
.import { x as y }
statement is from allowed list.import { x } from "source"
and import { x as y } from "source"
in the same file.