Skip to content

Commit

Permalink
fix(eslint): update linting ignore patterns
Browse files Browse the repository at this point in the history
ESLint was finding built files, when they existed, and not ignoring
them. This issue was two-fold:

1. The patterns weren't right per ESLint's new expectation for relative
   and recursive patterns, so the files would be considered if present
2. The ignores were only configured in our main config, such that other
   plugins and so on would not use the list of ignores

Updating the patterns and putting them in their own object at the start
of the final config returns us to a fast, passing lint even in the
presence of built files.
  • Loading branch information
daneah committed May 10, 2024
1 parent e13824d commit 6798334
Show file tree
Hide file tree
Showing 6 changed files with 306 additions and 57 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
32 changes: 20 additions & 12 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ import storybookPlugin from 'eslint-plugin-storybook';
import typeScriptEsLint from '@typescript-eslint/eslint-plugin';
import globals from 'globals';

const globalIgnores = [
'.storybook-static/',
'packages/pharos/coverage/',
'packages/pharos/lib/',
'packages/pharos/src/styles/**/*.ts',
'packages/pharos-site/public/',
'packages/pharos-site/.cache/',
'**/dist/',
'**/node_modules/',
'**/*.css.ts',
];

const pharosConfig = {
ignores: [
'node_modules/',
'dist/',
'lib/',
'.storybook-static/',
'packages/pharos/coverage/**/*.js',
'packages/pharos/src/styles/**/*.ts',
'packages/pharos-site/public/',
'packages/pharos-site/.cache/',
'**/*.css.ts',
],
languageOptions: {
parser: babelParser,
globals: {
Expand Down Expand Up @@ -107,4 +108,11 @@ const mdxConfig = {
},
};

export default [js.configs.recommended, pharosConfig, tsConfig, tsxConfig, mdxConfig];
export default [
{ ignores: globalIgnores },
js.configs.recommended,
pharosConfig,
tsConfig,
tsxConfig,
mdxConfig,
];
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@emotion/babel-plugin": "^11.11.0",
"@size-limit/preset-small-lib": "^11.1.2",
"@size-limit/preset-small-lib": "^11.1.3",
"@storybook/addon-a11y": "^8.0.10",
"@storybook/addon-essentials": "^8.0.10",
"@storybook/addon-links": "^8.0.10",
Expand Down Expand Up @@ -107,7 +107,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sass": "^1.77.0",
"size-limit": "^11.1.2",
"size-limit": "^11.1.3",
"storybook": "^8.0.10",
"stylelint": "^16.5.0",
"stylelint-config-standard-scss": "^13.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/pharos-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/node": "^20.12.10",
"@types/node": "^20.12.11",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"ts-morph": "^22.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/pharos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"replace-in-file": "^7.1.0",
"rimraf": "^5.0.5",
"rimraf": "^5.0.6",
"sassdoc": "^2.7.4",
"sinon": "^17.0.2",
"style-dictionary": "^3.9.2",
Expand Down

0 comments on commit 6798334

Please sign in to comment.