Skip to content

Ignore rule if file is dirty #2171

@FunctionDJ

Description

@FunctionDJ

I'm using eslint-plugin-prettier for CI (e.g. pull requests) to check if new code is formatted according to how Prettier formats.

When editing code however, the plugin's accompanying prettier/prettier rule is annoying because the point of auto-formatters is that you can just write code without formatting yourself and the code will be auto-formatted on save or similar.

Luckily this extension has an option to turn off rules like this:

	"eslint.rules.customizations": [{ "rule": "prettier/prettier", "severity": "off" }]

This works great, but what if I'm using something like codemods, codegen tools, or anything else that modifies or writes code without ESLint / Prettier integration? I'd need to remember to run prettier . --write or ESLint CLI - or find out the code isn't formatted when the code runs through CI.

Instead, if the .vscode/settings.json rule customization only applied to non-dirty files, issues of incorrect formatting (or other ESLint rules) would be visible much sooner but still won't be annoying while editing the file (when the file is dirty / unsaved).

I'm proposing a new option for eslint.rules.customizations entries like unsavedOnly?: boolean.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunities

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions