Skip to content

Option to allow eslint-disable comment before the header#51

Open
Leomaradan wants to merge 3 commits intoStuk:mainfrom
Leomaradan:main
Open

Option to allow eslint-disable comment before the header#51
Leomaradan wants to merge 3 commits intoStuk:mainfrom
Leomaradan:main

Conversation

@Leomaradan
Copy link
Copy Markdown

By default, in VSCode, the option for disabling a eslint rule for the whole file place the comment on top of the file, before the header. That cause the header rule to be invalid, and the eslint comment must be moved manually

This PR add an option allowDisableFirst. When enabled, the eslint-disable comment are ignored from the getLeadingComments function

@Stuk
Copy link
Copy Markdown
Owner

Stuk commented Aug 8, 2022

Thanks for the PR! Would you mind adding a test?

@bonkalol
Copy link
Copy Markdown

Must have option here

@tonyganchev
Copy link
Copy Markdown

Folks, the reason this was not working was the way the plugin reported lines / columns for the rule violation. All of this is fixed in @tony.ganchev/eslint-plugin-header which was forked from this plugin in 2024 since the current one saw no new updates. It supports ESLint 9 / 10 and oxlint with no hacks and solve all of these UX/behavior issues while also adding support for other formats such as CSS, HTML, MD, Vue, Svelte, YAML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants