Bug: excludedFiles in overrides do not apply some regexp pattern
See original GitHub issueEnvironment
Node version: 14.17.6 npm version: 6.14.15 Local ESLint version: 8.10.0 Global ESLint version: none Operating System: Darwin
What parser are you using?
What did you do?
Configuration
const commentsRules = require('../rules/comments');
const importRules = require('../rules/import');
const jestRules = require('../rules/jest');
const jsxA11yRules = require('../rules/jsx-a11y');
const reactRules = require('../rules/react');
const typescriptRules = require('../rules/typescript');
module.exports = {
root: true,
env: {
node: true,
browser: true,
es2020: true,
},
plugins: ['import', 'unused-imports', 'jest', 'jest-formatting', 'testing-library'],
extends: [
'eslint:recommended',
'airbnb',
'airbnb/hooks',
'airbnb-typescript',
'plugin:json/recommended-with-comments',
'plugin:eslint-comments/recommended',
'plugin:promise/recommended',
'plugin:no-unsanitized/DOM',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
extraFileExtensions: ['.json'],
projectFolderIgnoreList: [
'**/node_modules/**',
'./.github',
'./.husky',
'./.circleci',
'./stats',
'./docs',
'./documentations',
'./reports',
'./coverage',
'./build',
'./dist',
'./lib',
],
ecmaFeatures: {
jsx: true,
},
},
rules: {
...commentsRules,
...importRules,
...jsxA11yRules,
...reactRules,
...typescriptRules,
},
overrides: [
{
files: ['./public/locales/**/*.json'],
extends: ['plugin:i18n-json/recommended'],
rules: {
'i18n-json/valid-message-syntax': [
'error',
{
syntax: require.resolve('../parser/i18n/message-parser.js'),
},
],
'i18n-json/sorted-keys': [
'error',
{
order: 'asc',
indentSpaces: 2,
},
],
'i18n-json/valid-json': 'error',
},
},
{
files: ['./**/__tests__/**/*.[jt]s?(x)', './**/?(*.)+(spec|test).[jt]s?(x)'],
excludedFiles: ['./**/Storyshots.(spec|test).[jt]s?(x)'],
extends: ['plugin:jest/all', 'plugin:jest-formatting/strict', 'plugin:testing-library/react'],
env: {
'jest/globals': true,
},
rules: {
...jestRules,
// too hard to do in the codebase actually
'jest/prefer-expect-assertions': 'off',
},
},
],
};
// ./src/Storyshots.test.ts
import initStoryshots from '@storybook/addon-storyshots';
initStoryshots({});
What did you expect to happen?
Eslint should not check a file included by the excludedFiles
regexp
What actually happened?
Eslint is still checking a file when the regexp is including an ‘alternative’ pattern (parenthesis with pipe)
This does nos work (files are not excluded), but should :
// in overrides
excludedFiles: ['./**/Storyshots.(spec|test).[jt]s?(x)'],
This does work (files are excluded) :
// in overrides
excludedFiles: ['./**/Storyshots.test.[jt]s?(x)', './**/Storyshots.spec.[jt]s?(x)'],
Participation
- I am willing to submit a pull request for this issue.
Additional comments
Seems (spec|test)
is breaking the regexp pattern in excludedFiles
in an overrides
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Make ESLint apply rules to only certain file name patterns
Is it possible to configure ESLint in a way that it only applies rules to files that names are matching certain pattern?
Read more >Sonar.Coverage.Exclusions not excluding as expected based ...
Thank you for looking at my report. Directory is not excluded from code coverage calculations based on the regex pattern applied to the...
Read more >Ignoring Code - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Reference information for including or excluding files for backup
The Code42 app does not back up Windows UNC file paths ... so the Remove Deleted Files After setting does not apply to...
Read more >Configuration :: RuboCop Docs
All the previous logic does not apply if a specific configuration file is ... This means that any key-value pairs given in child...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tewarig Yes, let us know if you need any help.
can i work on this issue ?