Find and fix problems in your JavaScript code
(c) eslint.org
🐊Putout plugin helps to automate fixing ESLint plugins.
npm i @putout/plugin-eslint-plugin -D
- ✅ apply-flat-config-to-rule-tester;
- ✅ convert-context-to-source;
- ✅ convert-require-resolve-to-require;
- ✅ turn-off-schema;
- ✅ update-ecma-version;
{
"rules": {
"eslint-plugin/convert-context-to-source": "on",
"eslint-plugin/apply-flat-config-to-rule-tester": "on",
"eslint-plugin/convert-require-resolve-to-require": "on",
"eslint-plugin/turn-off-schema": "on",
"eslint-plugin/update-ecma-version": ["on", {
"ecmaVersion": 2024
}]
}
}
When ESLint v9.0.0 is released, it will ship with several breaking changes for rule authors. These changes are necessary as part of the work to implement language plugins, which gives ESLint first-class support for linting languages other than JavaScript.
(c) eslint.org
Checkout in 🐊Putout Editor.
context.parserServices;
sourceCode.parserServices;
context.getAncestors(node);
context.getDeclaredVariables(node);
context.getScope();
context.getCwd();
context.getSourceCode();
context.markVariableAsUsed(name);
context.getFilename();
context.getPhysicalFilename();
const nextNode = context.getNodeByRangeIndex(node.range[1] + 2);
context.getSource();
context.getSourceLines();
context.getAllComments();
context.getComments();
context.getCommentsBefore();
context.getCommentsAfter();
context.getCommentsInside();
context.getJSDocComment();
context.getFirstToken();
context.getFirstTokens();
context.getLastToken();
context.getLastTokens();
context.getTokenAfter();
context.getTokenBefore();
context.getTokenByRangeStart();
context.getTokens();
context.getTokensAfter();
context.getTokensBefore();
context.getTokensBetween();
context.parserServices;
sourceCode.parserServices;
sourceCode.parserServices;
sourceCode.getAncestors(node);
sourceCode.getDeclaredVariables(node);
sourceCode.getScope();
context.cwd;
context.sourceCode;
sourceCode.markVariableAsUsed(name);
context.filename;
context.physicalFilename;
const nextNode = sourceCode.getNodeByRangeIndex(node.range[1] + 2);
sourceCode.getText();
sourceCode.getLines();
sourceCode.getAllComments();
sourceCode.getComments();
sourceCode.getCommentsBefore();
sourceCode.getCommentsAfter();
sourceCode.getCommentsInside();
sourceCode.getJSDocComment();
sourceCode.getFirstToken();
sourceCode.getFirstTokens();
sourceCode.getLastToken();
sourceCode.getLastTokens();
sourceCode.getTokenAfter();
sourceCode.getTokenBefore();
sourceCode.getTokenByRangeStart();
sourceCode.getTokens();
sourceCode.getTokensAfter();
sourceCode.getTokensBefore();
sourceCode.getTokensBetween();
sourceCode.parserServices;
Checkout in 🐊Putout Editor.
const parserTester = new RuleTester({
parser: require.resolve('@babel/eslint-parser/experimental-worker'),
parserOptions: {
requireConfigFile: false,
babelOptions: {
plugins: ['@babel/plugin-syntax-typescript'],
},
},
});
const parserTester = new RuleTester({
parser: require.resolve('@babel/eslint-parser/experimental-worker'),
parserOptions: {
requireConfigFile: false,
babelOptions: {
plugins: ['@babel/plugin-syntax-typescript'],
},
},
});
Checkout in 🐊Putout Editor.
const test = new RuleTester({
languageOptions: {
parser: require.resolve('@babel/eslint-parser/experimental-worker'),
parserOptions: {
requireConfigFile: false,
babelOptions: {
plugins: ['@babel/plugin-syntax-typescript'],
},
},
},
});
const test = new RuleTester({
languageOptions: {
parser: require('@babel/eslint-parser/experimental-worker'),
parserOptions: {
requireConfigFile: false,
babelOptions: {
plugins: ['@babel/plugin-syntax-typescript'],
},
},
},
});
Checkout in 🐊Putout Editor.
function getMeta(plugin) {
const {
type = 'layout',
recommended = true,
fixable = 'whitespace',
} = plugin;
return {
type,
docs: {
recommended,
},
schema: {},
fixable,
};
}
function getMeta(plugin) {
const {
type = 'layout',
recommended = true,
fixable = 'whitespace',
} = plugin;
return {
type,
docs: {
recommended,
},
schema: false,
fixable,
};
}
Checkout in 🐊Putout Editor.
const ruleTester = new RuleTester({
languageOptions: {
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
},
});
const ruleTester = new RuleTester({
languageOptions: {
parserOptions: {
ecmaVersion: 2024,
sourceType: 'module',
},
},
});
MIT