Integrate AutoCorrect with ESLint.
The plugin requires eslint >= 9.
Install eslint-plugin-autocorrect
using your package manager, and add this to eslint.config.js
:
import autocorrect from 'eslint-plugin-autocorrect';
import { defineConfig } from 'eslint/config';
export default defineConfig([
{
plugins: {
autocorrect,
},
rules: {
'autocorrect/issue': 'error',
},
},
]);
The plugin provides a single rule autocorrect/issue
to report issues found by AutoCorrect, and auto-fixes.
The autocorrect/issue
rule accepts an optional object with the following properties:
messageStyle
: Configures the style of the error message."default"
(default): Shows "Correct it" as the message."correct"
: Shows the corrected text as the message.
Example configuration:
export default defineConfig([
{
plugins: {
autocorrect,
},
rules: {
'autocorrect/issue': ['error', { messageStyle: 'correct' }],
},
},
]);