@lcooper/eslint-plugin
v1.4.0
Published
Awesome extra ESLint rules
Downloads
30
Maintainers
Readme
@lcooper/eslint-plugin
Awesome extra ESLint rules.
Installation
install with npm:
npm install -D eslint @lcooper/eslint-plugin
install with yarn:
yarn add -D eslint @lcooper/eslint-plugin
Usage
Configuration (legacy .eslintrc
):
Add @lcooper/eslint-plugin
or just @lcooper
to the plugins section of your eslintrc
configuration file.
Next, configure the rules you want to use under the rules
section, or use the plugin:@lcooper/all
bundled config that enables all plugin rules and disables any conflicting base ESLint rules. This can be configured using the extends
property in your .eslintrc
config file:
{
"plugins": [
"@lcooper"
],
"extends": [
"plugin:@lcooper/all"
]
}
Configuration (new eslint.config.js
):
If you are using the new flat config system, you can add the bundled all/flat
config to the exported config array in your eslint.config.js
file:
const plugin = require('@lcooper/eslint-plugin');
module.exports = [
// ... other configs
plugin.configs['all/flat'],
];
Rules
:wrench: = Fixable
| Name | Description | |
| :-- | :-- | :--: |
| consecutive-declarations
| Enforce a consistent style for consecutive const
, let
, and var
declarations | :wrench: |
| global-require
| Ensure require()
calls are in the top-level module scope | |
| prefer-template
| Suggest using template literals instead of string concatenation | :wrench: |
| top-level-padding-lines
| Require or disallow empty lines between top level statements | :wrench: |
Related
ESLint configs that utilize this plugin:
@lcooper/eslint-config
- Base config for standard JavaScript projects@lcooper/eslint-config-react
- Config for React projects@lcooper/eslint-config-typescript
- Config for TypeScript projects@lcooper/eslint-config-typescript-react
- Config for TypeScript + React projects@lcooper/eslint-config-jest
- Enhancement config for projects using Jest