
Security News
Next.js Patches Critical Middleware Vulnerability (CVE-2025-29927)
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
@putout/eslint
Advanced tools
Wrapper that simplifies ESLint API and makes it compatible with 🐊Putout
Wrapper that simplifies ESLint API and makes it compatible with 🐊Putout.
☝️ FlatConfig supported from the box.
npm i @putout/eslint
ESLINT_CONFIG_FILE
env variable:NO_ESLINT=1
env variable:NO_ESLINT_WARNINGS=1
:NO_ESLINT_WARNINGS=1 putout --fix lib
## API
### `eslint(options)`
**ESLint** begins his work as a formatter when 🐊**Putout** done his transformations. That's why it used a lot in different parts of application, for testing purpose and using **API** in a simplest possible way. You can access it with:
```js
import eslint from '@putout/eslint';
To use it simply write:
const [source, places] = await eslint({
name: 'hello.js',
code: `const t = 'hi'\n`,
fix: false,
});
Isn't it looks similar to 🐊Putout way? It definitely is! But... It has a couple differences you should remember:
code
and places
properties, and ESLint returns a tuplename
property that is used to calculate configuration file.And you can even override any of ESLint ⚙️ options with help of config
property:
import {safeAlign} from 'eslint-plugin-putout';
const [source, places] = await eslint({
name: 'hello.js',
code: `const t = 'hi'\n`,
fix: false,
config: [safeAlign],
});
If you want to apply 🐊Putout transformations using putout/putout
ESLint rule, enable 🐊Putout with the same called but lowercased flag:
import {safeAlign} from 'eslint-plugin-putout';
const [source, places] = await eslint({
name: 'hello.js',
code: `const t = 'hi'\n`,
fix: true,
putout: true,
config: [safeAlign],
});
It is disabled by default, because ESLint always runs after 🐊Putout transformations, so there is no need to traverse tree again.
createPlugin(options)
You can also simplify creating of plugins for ESLint with help of createPlugin
.
🐊Putout-based ESLint plugin are highly inspired by Putout Plugins API of Includer.
So it must contain classic 4
methods:
module.exports.report = () => 'debugger statement should not be used';
module.exports.fix = (path) => {
return '';
};
module.exports.include = () => [
'DebuggerStatement',
];
module.exports.filter = (path) => {
return true;
};
The main difference with Includer is:
fix
works with text;include
does not support 🦎PutoutScript;exclude
;Take a look at more sophisticated example, rule remove-duplicate-extensions
:
const getValue = ({source}) => source?.value;
module.exports.report = () => 'Avoid duplicate extensions in relative imports';
module.exports.include = () => [
'ImportDeclaration',
'ImportExpression',
'ExportAllDeclaration',
'ExportNamedDeclaration',
];
module.exports.fix = ({text}) => {
return text.replace('.js.js', '.js');
};
module.exports.filter = ({node}) => {
const value = getValue(node);
return /\.js\.js/.test(value);
};
To use it just add couple lines to your main plugin file:
const {createPlugin} = require('@putout/eslint/create-plugin');
const createRule = (a) => ({
[a]: createPlugin(require(`./${a}`)),
});
module.exports.rules = {
...createRule('remove-duplicate-extensions'),
};
Or just:
const {createPlugin} = require('@putout/eslint/create-plugin');
module.exports.rules = {
'remove-duplicate-extensions': createPlugin(require('./remove-duplicate-extensions')),
};
lint(source, {fix, plugins, options, filename})
When you need to run ESLint with one plugin (rule), just use lint
it will do the thing.
const lint = require('@putout/eslint/lint');
const {createPlugin} = require('@putout/eslint/create-plugin');
const removeDebugger = require('./remove-debugger');
const [code, places] = lint('debugger', {
fix: true, // default
plugins: [
['remove-debugger', createPlugin(removeDebugger)],
],
});
When you want to skip plugins, and just provide options
and filename
you can:
const lint = require('@putout/eslint/lint');
const [code, places] = lint('debugger', {
filename: 'index.js',
options: [{
rules: {
semi: 'error',
},
}],
});
MIT
FAQs
Wrapper that simplifies ESLint API and makes it compatible with 🐊Putout
The npm package @putout/eslint receives a total of 6,705 weekly downloads. As such, @putout/eslint popularity was classified as popular.
We found that @putout/eslint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.