Awesome extra ESLint rules.
install with npm:
npm install -D eslint @lcooper/eslint-plugin
install with yarn:
yarn add -D eslint @lcooper/eslint-plugin
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"
]
}
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'],
];
🔧 = Fixable
Name | Description | |
---|---|---|
consecutive-declarations |
Enforce a consistent style for consecutive const , let , and var declarations |
🔧 |
global-require |
Ensure require() calls are in the top-level module scope |
|
prefer-template |
Suggest using template literals instead of string concatenation | 🔧 |
top-level-padding-lines |
Require or disallow empty lines between top level statements | 🔧 |
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