Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: Update Default Ignore Patterns #51

Merged
merged 3 commits into from
Jan 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions designs/2019-update-default-ignore-patterns/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
- Start Date: 2019-11-28
- RFC PR: https://github.com/eslint/rfcs/pull/51
- Authors: Toru Nagashima ([@mysticatea](https://github.com/mysticatea))

# Update Default Ignore Patterns

## Summary

This proposal changes the default ignore patterns to include `node_modules` in subdirectories and to exclude `.eslintrc.js`.

## Motivation

- In monorepo style development, there are `node_modules`s in subdirectories. But the current default ignore patterns don't include it, so we have to configure ESLint with `node_modules` to ignore it.
- Because ESLint ignores dotfiles, it doesn't lint `.eslintrc.js` by default. We have to configure ESLint with `!.eslintrc.js` to lint it.

## Detailed Design

This proposal changes the default ignore patterns:

- (as-is) `.*`
- (new) `!.eslintrc.js`
- (change) `/node_modules/*` → `/**/node_modules/*`
- (remove) ~~`/bower_components/*`~~

Therefore, ESLint ignores `node_modules` in subdirectories, and no longer ignores `.eslintrc.js` and `bower_components`.

### How about the config files of other tools?

For example, Babel has `.babelrc.js` and VuePress has `.vuepress/config.js`. ESLint ignores such files as dotfiles by default.

This proposal doesn't change this behavior because we don't want to have allowlist/denylist for all tools in the world. Instead, we can have unignoring patterns in the `ignorePatterns` property of shareable configs for your tools.

## Documentation

- It needs an entry in the migration guide for 7.0.0 (or another major release) because of breaking changes.
- It needs to update the "[.eslintignore](https://eslint.org/docs/user-guide/configuring#eslintignore)" section to explain the new default ignore patterns.

## Drawbacks

This proposal doesn't increase maintenance cost because it just updates a pattern list.

If somebody wants to lint `node_modules` in subdirectories, they have to configure ESLint to unignore those. But I guess that it's rarer than wanting to ignore `node_modules` in subdirectories.

## Backwards Compatibility Analysis

This is a breaking change.

- ESLint may report more warnings on `.eslintrc.js`.
- ESLint may report more warnings in `bower_components`.
- ESLint may stop with fatal errors (all files are ignored) in the `node_modules` of subdirectories.

## Alternatives

We can use the `ignorePatterns` of shareable configs to configure and reuse this kind of matter.

## Related Discussions

- https://github.com/eslint/eslint/issues/1163 - ignore node_modules folder by default
- https://github.com/eslint/eslint/issues/10089 - .babelrc.js should not be ignored by default
- https://github.com/eslint/eslint/issues/10341 - do not ignore files started with `.` by default
- https://github.com/eslint/tsc-meetings/blob/master/notes/2019/2019-12-05.md#remove-bower_components-from-default-ignores