🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter, drop-in ESLint superpower replacement 💪 with built-in support for js, jsx, typescript, flow, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏
Installations
npm install @putout/plugin-eslint
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=18
Node Version
22.13.0
NPM Version
10.9.0
Score
66.1
Supply Chain
90.3
Quality
86.1
Maintenance
100
Vulnerability
97.9
License
Releases
Contributors
Languages
JavaScript (99.09%)
TypeScript (0.65%)
HTML (0.17%)
WebAssembly (0.05%)
CSS (0.02%)
Svelte (0.01%)
Developer
Download Statistics
Total Downloads
1,534,531
Last Day
2,592
Last Week
11,067
Last Month
47,863
Last Year
666,706
GitHub Statistics
722 Stars
14,749 Commits
40 Forks
10 Watching
46 Branches
24 Contributors
Bundle Size
10.96 kB
Minified
3.25 kB
Minified + Gzipped
Package Meta Information
Latest Version
10.0.0
Package Id
@putout/plugin-eslint@10.0.0
Unpacked Size
38.45 kB
Size
9.00 kB
File Count
26
NPM Version
10.9.0
Node Version
22.13.0
Publised On
21 Jan 2025
Total Downloads
Cumulative downloads
Total Downloads
1,534,531
Last day
-3.2%
2,592
Compared to previous day
Last week
-4.7%
11,067
Compared to previous week
Last month
0.2%
47,863
Compared to previous month
Last year
77.8%
666,706
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
@putout/plugin-eslint
Find and fix problems in your JavaScript code
(c) eslint.org
🐊Putout plugin helps to automate fixing ESLint config.
Install
npm i @putout/plugin-eslint -D
Rules
- ✅ add-putout;
- ✅ apply-dir-to-flat;
- ✅ apply-match-to-flat;
- ✅ apply-safe-align;
- ✅ convert-export-match-to-declaration;
- ✅ convert-files-to-array;
- ✅ convert-ide-to-safe;
- ✅ convert-node-to-n;
- ✅ convert-plugins-array-to-object;
- ✅ convert-rc-to-flat;
- ✅ convert-require-to-import;
- ✅ declare;
- ✅ move-putout-to-end-of-extends;
- ✅ remove-no-missing;
- ✅ remove-no-unpublished-require;
- ✅ remove-no-unsupported-features;
- ✅ remove-overrides-with-empty-rules;
- ✅ remove-useless-slice;
- ✅ remove-useless-properties;
Config
1{ 2 "rules": { 3 "eslint/add-putout": "on", 4 "eslint/apply-dir-to-flat": "on", 5 "eslint/apply-safe-align": "on", 6 "eslint/apply-match-to-flat": "on", 7 "eslint/move-putout-to-end-of-extends": "on", 8 "eslint/convert-export-match-to-decleration": "on", 9 "eslint/convert-files-to-array": "on", 10 "eslint/convert-ide-to-safe": "on", 11 "eslint/convert-require-to-import": "on", 12 "eslint/convert-node-to-n": "on", 13 "eslint/declare": "on", 14 "eslint/remove-no-missing": "on", 15 "eslint/remove-no-unpublished-require": "on", 16 "eslint/remove-no-unsupported-features": "on", 17 "eslint/remove-overrides-with-empty-rules": "on", 18 "eslint/remove-useless-slice": "on", 19 "eslint/remove-useless-properties": "on", 20 "eslint/convert-plugins-array-to-object": "on", 21 "eslint/convert-rc-to-flat": "off" 22 } 23}
add-putout
1{ 2 "extends": [ 3+ "plugin:putout/safe+align", 4 "plugin:node/recommended" 5 ], 6 "plugins": [ 7+ "putout", 8 "node" 9 ] 10}
apply-safe-align
1{ 2- "rules": { 3- "putout/align-spaces": "error" 4- }, 5 "extends": [ 6- "plugin:putout/safe", 7+ "plugin:putout/safe+align", 8 "plugin:node/recommended" 9 ], 10 "plugins": [ 11 "putout", 12 "node" 13 ] 14}
apply-dir-to-flat
matchToFlatDir()
and mergeESLintConfigs
supports __dirname
or import.meta.url
starting from v2
of @putout/eslint-flat
.
Check out in 🐊Putout Editor.
❌ Example of incorrect code
1const scriptsConfig = await matchToFlatDir('scripts'); 2const monoConfig = await mergeESLintConfigs(['codemods', 'packages', 'rules']); 3 4module.exports = [ 5 ...scriptsConfig, 6 ...monoConfig, 7];
✅ Example of correct code
1// CommonJS
2const scriptsConfig = await matchToFlatDir(__dirname, 'scripts');
3
4// ESM
5const monoConfig = await mergeESLintConfigs(import.meta.url, ['codemods', 'packages', 'rules']);
6
7module.exports = [
8 ...scriptsConfig,
9 ...monoConfig,
10];
apply-match-to-flat
Check out in 🐊Putout Editor.
❌ Example of incorrect code
1import {safeAlign} from 'eslint-plugin-putout/config'; 2 3export default [ 4 ...safeAlign, { 5 files: ['*.d.ts'], 6 rules: { 7 'no-var': 'off', 8 }, 9 }, { 10 files: ['*.spec.*'], 11 rules: { 12 'node/no-extraneous-import': 'off', 13 }, 14 }, 15];
✅ Example of correct code
1import {safeAlign} from 'eslint-plugin-putout/config'; 2 3const config = matchToFlat({ 4 '*.d.ts': { 5 'no-var': 'off', 6 }, 7 '*.spec.*': { 8 'node/no-extraneous-import': 'off', 9 }, 10}); 11 12export default [ 13 ...safeAlign, 14 ...config, 15];
move-putout-to-end-of-extends
❌ Example of incorrect code
1{ 2 "extends": [ 3 "plugin:putout/recommended", 4 "plugin:node/recommended" 5 ], 6 "plugins": [ 7 "putout", 8 "node" 9 ] 10}
✅ Example of correct code
1{ 2 "extends": [ 3 "plugin:node/recommended", 4 "plugin:putout/recommended" 5 ], 6 "plugins": [ 7 "putout", 8 "node" 9 ] 10}
convert-ide-to-safe
❌ Example of incorrect code
1{ 2 "extends": [ 3 "plugin:node/recommended", 4 "plugin:putout/ide" 5 ], 6 "plugins": [ 7 "putout", 8 "node" 9 ] 10}
✅ Example of correct code
1{ 2 "extends": [ 3 "plugin:node/recommended", 4 "plugin:putout/safe" 5 ], 6 "plugins": [ 7 "putout", 8 "node" 9 ] 10}
convert-files-to-array
Check it out in 🐊Putout Editor.
1{ 2 "overrides": [{ 3- "files": "test/*.js", 4+ "files": ["test/*.js"], 5 "rules": { 6 "node/no-missing-require": "off" 7 } 8 }], 9};
convert-require-to-import
node/no-missing-require
has no sense when type=module
in package.json
.
Check it out in 🐊Putout Editor.
1{ 2 "overrides": [{ 3 "files": "test/*.js", 4 "rules": { 5- "node/no-missing-require": "off" 6+ "node/no-missing-import": "off" 7 } 8 }], 9 "extends": [ 10 "plugin:node/recommended", 11 "plugin:putout/recommended" 12 ], 13 "plugins": [ 14 "putout", 15 "node" 16 ] 17};
remove-no-unpublished-require
node/remove-no-unpublished-require
should be enabled, since this is a very useful rule, which shows what files should be add to .npmignore
.
1{ 2 "overrides": [{ 3 "files": "test/*.js", 4 "rules": { 5- "node/no-unpublished-require": "off" 6 } 7 }], 8 "extends": [ 9 "plugin:node/recommended", 10 "plugin:putout/recommended" 11 ], 12 "plugins": [ 13 "putout", 14 "node" 15 ] 16};
remove-no-unsupported-features
node/remove-no-unsupported-features
is already disabled in eslint-plugin-putout.
1{ 2 "overrides": [{ 3 "files": "test/*.js", 4 "rules": { 5- "node/no-unpublished-require": "off" 6 } 7 }], 8 "extends": [ 9 "plugin:node/recommended", 10 "plugin:putout/recommended" 11 ], 12 "plugins": [ 13 "putout", 14 "node" 15 ] 16};
remove-overrides-with-empty-rules
overrides
with rules: {}
has no sense. Check out in 🐊Putout Editor:
Remove overrides
with one element with empty rules
:
1{ 2- "overrides": [{ 3- "files": "test/*.js", 4- "rules": { 5- } 6- }], 7 "extends": [ 8 "plugin:node/recommended", 9 "plugin:putout/recommended" 10 ], 11 "plugins": [ 12 "putout", 13 "node" 14 ] 15};
Or remove empty overrides
:
1{ 2- "overrides": [], 3 "extends": [ 4 "plugin:node/recommended", 5 "plugin:putout/recommended" 6 ], 7 "plugins": [ 8 "putout", 9 "node" 10 ] 11};
And ofcourse remove only elements with empty rules
:
1{ 2 "overrides": [{ 3- "files": "test/*.js", 4- "rules": { 5- } 6- }, { 7 "files": "test/*.js", 8 "rules": { 9 "no-semi": "off" 10 } 11 }], 12 "extends": [ 13 "plugin:node/recommended", 14 "plugin:putout/recommended" 15 ], 16 "plugins": [ 17 "putout", 18 "node" 19 ] 20};
convert-node-to-n
eslint-plugin-node
is no longer supported. Better to use eslint-plugin-n
.
1{ 2 "extends": [ 3 "plugin:putout/safe+align", 4- "plugin:node/recommended" 5+ "plugin:n/recommended" 6 ], 7 "plugins": [ 8 "putout", 9- "node" 10+ "n" 11 ] 12}
remove-no-missing
node/remove-no-missing-require
and node/remove-no-missing-import
doesn't supports exports
and already disabled by eslint-plugin-putout
.
1{ 2 "overrides": [{ 3 "files": "test/*.js", 4 "rules": { 5- "node/no-missing-require": "off", 6- "node/no-missing-import": "off" 7 } 8 }], 9 "extends": [ 10 "plugin:node/recommended", 11 "plugin:putout/recommended" 12 ], 13 "plugins": [ 14 "putout", 15 "node" 16 ] 17};
remove-useless-slice
Fixes code after convert-array-copy-to-slice
.
Checkout in 🐊Putout Editor.
❌ Example of incorrect code
1export default x.slice(); 2 3module.exports = x.slice();
✅ Example of correct code
1export default x; 2 3module.exports = x;
remove-useless-properties
Checkout in 🐊Putout Editor.
❌ Example of incorrect code
1module.exports = [ 2 ...safeAlign, { 3 rules: {}, 4 }, 5];
✅ Example of correct code
1module.exports = safeAlign;
convert-export-match-to-declaration
Fixes apply-match-to-flat. Checkout in 🐊Putout Editor.
❌ Example of incorrect code
1module.exports.match = { 2 'bin/**': { 3 'no-process-exit': 'off', 4 }, 5}; 6 7module.exports = [ 8 ...safeAlign, { 9 rules: { 10 'node/no-unsupported-features/node-builtins': 'off', 11 }, 12 }, 13 ...matchToFlat(match), 14];
✅ Example of correct code
1const match = { 2 'bin/**': { 3 'no-process-exit': 'off', 4 }, 5}; 6 7module.exports = [ 8 ...safeAlign, { 9 rules: { 10 'node/no-unsupported-features/node-builtins': 'off', 11 }, 12 }, 13 ...matchToFlat(match), 14]; 15 16module.exports.match = match;
declare
Declare:
convert-plugins-array-to-object
On the surface, using a plugin in
flat config
looks very similar to using a plugin ineslintrc
. The big difference is thateslintrc
usedstring
s whereasflat configs
usesobject
s. Instead of specifying the name of a plugin, you import the plugin directly and place it into the pluginskey
.(c) eslint.org
Checkout in 🐊Putout Editor.
❌ Example of incorrect code
1export default { 2 plugins: [react], 3}; 4 5module.exports = { 6 plugins: ['react'], 7};
✅ Example of correct code
1export default { 2 plugins: { 3 react, 4 }, 5}; 6 7module.exports = { 8 plugins: ['react'], 9};
convert-rc-to-flat
Checkout in 🐊Putout Editor:
Converts .eslintrc.json
:
1{ 2 "root": true, 3 "parser": "@typescript-eslint/parser", 4 "env": { 5 "node": true 6 }, 7 "extends": ["eslint:recommended"], 8 "plugins": ["@nx"], 9 "rules": { 10 "@typescript-eslint/explicit-module-boundary-types": "error" 11 }, 12 "overrides": [{ 13 "files": ["*.json"], 14 "parser": "jsonc-eslint-parser" 15 }, { 16 "files": [ 17 "*.ts", 18 "*.tsx", 19 "*.js", 20 "*.jsx" 21 ], 22 "rules": { 23 "@nx/enforce-module-boundaries": ["error", { 24 "enforceBuildableLibDependency": true, 25 "allow": [], 26 "depConstraints": [{ 27 "sourceTag": "*", 28 "onlyDependOnLibsWithTags": ["*"] 29 }] 30 }] 31 } 32 }] 33}
To .eslint.config.js
:
1const nxPlugin = require('@nx/eslint-plugin'); 2const js = require('@eslint/js'); 3const globals = require('globals'); 4const jsoncParser = require('jsonc-eslint-parser'); 5const tsParser = require('@typescript-eslint/parser'); 6 7module.exports = [ 8 js.configs.recommended, { 9 plugins: { 10 '@nx': nxPlugin, 11 }, 12 }, { 13 languageOptions: { 14 parser: tsParser, 15 globals: { 16 ...globals.node, 17 }, 18 }, 19 rules: { 20 '@typescript-eslint/explicit-module-boundary-types': ['error'], 21 }, 22 }, { 23 files: ['*.json'], 24 languageOptions: { 25 parser: jsoncParser, 26 }, 27 rules: {}, 28 }, { 29 files: [ 30 '*.ts', 31 '*.tsx', 32 '*.js', 33 '*.jsx', 34 ], 35 rules: { 36 '@nx/enforce-module-boundaries': ['error', { 37 enforceBuildableLibDependency: true, 38 allow: [], 39 depConstraints: [{ 40 sourceTag: '*', 41 onlyDependOnLibsWithTags: ['*'], 42 }], 43 }], 44 }, 45 }];
License
MIT
No vulnerabilities found.
Reason
30 commit(s) and 4 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
no binaries found in the repo
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/nodejs-pr.yml:1
- Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1
- Info: no jobLevel write permissions found
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs-pr.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs-pr.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs-pr.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs-pr.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs-pr.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs-pr.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs-pr.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs-pr.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/coderaiser/putout/nodejs.yml/master?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 4 third-party GitHubAction dependencies pinned
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
4.8
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to @putout/plugin-eslint
putout
🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json
eslint-plugin-putout
ESLint plugin for 🐊Putout
@putout/plugin-eslint-plugin
🐊Putout plugin for eslint config
@2chevskii/eslint-plugin-putout
Modified eslint-plugin-putout