Menu

Codemod for ignoring lint errors
📰

Codemod for ignoring lint errors

DEV Community·Isaac Lee·6 months ago
#RjH5HOgl
#javascript#ember#showdev#opensource#errors
Reading 0:00
15s threshold

Meet my new codemod, ignore-lint-errors . It helps us ignore lint errors from eslint , stylelint , and typescript ( glint for Ember projects).

A. Why should we ignore errors

In large production projects, ignoring lint errors for existing code is the most pragmatic, quickest approach to complete these tasks:

Introduce a new lint rule.

Update a linter to the next minor or major version.

Migrate code to a different format, e.g. convert *.{gjs,js} (JavaScript) to *.{gts,ts} (TypeScript).

For the sake of reducing noise, some prefer disabling linting for the entire file. They do so by adding a global directive (e.g. eslint-disable ) or creating a special file to "suppress" files with many errors.

Instead, ignore-lint-errors takes the honest approach: It adds a local directive (e.g. eslint-disable-next-line ) for every line that has an error. This way, we can easily see and show others (including non-engineers and AIs),

How bad our code is to increase the urgency to fix issues.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.