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

Remove ignoring bower_components folder by default #4384

Merged
merged 2 commits into from Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/user-guide/cli.md
Expand Up @@ -172,7 +172,7 @@ Ignore `styleline-disable` comments.

### `--disable-default-ignores, --di`

Allow linting of `node_modules` and `bower_components`.
Allow linting of `node_modules`.

### `--cache`

Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/configuration.md
Expand Up @@ -290,7 +290,7 @@ If the globs are absolute paths, they are used as is. If they are relative, they
- the config's filepath, if the config is a file that stylelint found a loaded;
- or `process.cwd()`.

By default, all `node_modules` and `bower_components` are ignored. Default values will be overridden if `ignoreFiles` is set.
By default, all `node_modules` are ignored. Default values will be overridden if `ignoreFiles` is set.

The `ignoreFiles` property is stripped from extended configs: only the root-level config can ignore files.

Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/node-api.md
Expand Up @@ -66,7 +66,7 @@ A file glob, or array of file globs. Ultimately passed to [globby](https://githu

Relative globs are considered relative to `globbyOptions.cwd`.

By default, all `node_modules` and `bower_components` are ignored.
By default, all `node_modules` are ignored.

### `globbyOptions`

Expand All @@ -92,7 +92,7 @@ You can use this option to see what your linting results would be like without t

### `disableDefaultIgnores`

If `true`, stylelint will not automatically ignore the contents of `node_modules` and `bower_components`. (By default, these directories are automatically ignored.)
If `true`, stylelint will not automatically ignore the contents of `node_modules`. (By default, this directory are automatically ignored.)

### `cache`

Expand Down
23 changes: 3 additions & 20 deletions lib/__tests__/ignore.test.js
Expand Up @@ -312,25 +312,9 @@ test('file in node_modules is ignored', () => {
});
});

test('file in bower_components is ignored', () => {
const files = [`${fixturesPath}/bower_components/test.css`];
const noFilesErrorMessage = new NoFilesFoundError(files);

return standalone({
files,
config: {
rules: {
'block-no-empty': true,
},
},
}).catch((actualError) => {
expect(actualError).toEqual(noFilesErrorMessage);
});
});

test('disableDefaultIgnores allows paths in node_modules and bower_components', () => {
test('disableDefaultIgnores allows paths in node_modules', () => {
return standalone({
files: [`${fixturesPath}/bower_components/test.css`, `${fixturesPath}/node_modules/test.css`],
files: [`${fixturesPath}/node_modules/test.css`],
disableDefaultIgnores: true,
config: {
rules: {
Expand All @@ -339,8 +323,7 @@ test('disableDefaultIgnores allows paths in node_modules and bower_components',
},
}).then(({ results }) => {
// They are not ignored
expect(results).toHaveLength(2);
expect(results).toHaveLength(1);
expect(results[0].warnings).toHaveLength(1);
expect(results[1].warnings).toHaveLength(1);
});
});
7 changes: 3 additions & 4 deletions lib/cli.js
Expand Up @@ -242,9 +242,8 @@ const meowOptions /*: meowOptionsType*/ = {
Input: Files(s), glob(s), or nothing to use stdin.

If an input argument is wrapped in quotation marks, it will be passed to
globby for cross-platform glob support. node_modules and
bower_components are always ignored. You can also pass no input and use
stdin, instead.
globby for cross-platform glob support. node_modules are always ignored.
You can also pass no input and use stdin, instead.

Options:

Expand Down Expand Up @@ -306,7 +305,7 @@ const meowOptions /*: meowOptionsType*/ = {

--disable-default-ignores, --di

Allow linting of node_modules and bower_components.
Allow linting of node_modules.

--cache [default: false]

Expand Down
2 changes: 1 addition & 1 deletion lib/standalone.js
Expand Up @@ -20,7 +20,7 @@ const pkg = require('../package.json');
const { default: ignore } = require('ignore');
const DEFAULT_IGNORE_FILENAME = '.stylelintignore';
const FILE_NOT_FOUND_ERROR_CODE = 'ENOENT';
const ALWAYS_IGNORED_GLOBS = ['**/node_modules/**', '**/bower_components/**'];
const ALWAYS_IGNORED_GLOBS = ['**/node_modules/**'];
const writeFileAtomic = require('write-file-atomic');

/** @typedef {import('stylelint').StylelintStandaloneOptions} StylelintOptions */
Expand Down