-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#147) Update Node, Webpack, Misc security updates
Updates node to 20, webpack to v8 and addresses security updates ``` nvm install 20 nvm use 20 ``` * Updates LTS in `.nvmrc` `npm install webpack@latest --save-dev` - Updates webpack config to address CRA CommonJS bug affecting axios/nock/jest combo facebook/create-react-app#11889 (comment) - Updater syntax change for IgnorePlugin in webpack config - Misc webpack config changes following migration guide: https://webpack.js.org/migrate/5/ - Moves jest config out of package.json into own config - Adds axios to transformIgnoreModules `npm audit fix --force`
- Loading branch information
1 parent
49be2f3
commit b2621e8
Showing
78 changed files
with
19,285 additions
and
49,886 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,77 @@ | ||
const jestRules = require('eslint-plugin-jest').rules; | ||
const jestDomRules = require('eslint-plugin-jest-dom').rules; | ||
const testLibRules = require('eslint-plugin-testing-library').rules; | ||
|
||
const disableAllRules = (pluginName, rules) => { | ||
return Object.keys(rules).reduce((ac, ruleName) => { | ||
return { | ||
...ac, | ||
[`${pluginName}/${ruleName}`]: 'off', | ||
}; | ||
}, {}); | ||
}; | ||
|
||
// We need to turn off jest rules for cypress because | ||
// Cypress uses expect. | ||
const cypressRuleDisables = { | ||
...disableAllRules('jest', jestRules), | ||
...disableAllRules('jest-dom', jestDomRules), | ||
...disableAllRules('testing-library', testLibRules), | ||
}; | ||
|
||
// Default to development if we've somehow hit the linter without it being set | ||
// react-scritps technically sets this to development also | ||
if (process.env.NODE_ENV == null) { | ||
process.env.NODE_ENV = 'development'; | ||
} | ||
|
||
module.exports = { | ||
extends: ['@nciocpl/eslint-config-react', 'plugin:jest/recommended', 'plugin:jest-dom/recommended'], | ||
plugins: ['testing-library', 'jest', 'jest-dom'], | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, | ||
jest: true, | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:react/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:jsx-a11y/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
parser: 'babel-eslint', | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
ecmaVersion: 2016, | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
babelOptions: { | ||
presets: ['@babel/preset-react'], | ||
}, | ||
}, | ||
// Plugins are configured by the recommended extensions above | ||
rules: { | ||
'react/display-name': 'off', | ||
'react-hooks/exhaustive-deps': 'off', | ||
'testing-library/no-render-in-setup': 'off', // This is now no-render-in-lifecycle. Remove when NCIOCPL standards are updated. | ||
'testing-library/no-render-in-lifecycle': 'error', | ||
|
||
'testing-library/prefer-wait-for': 'off', // This is now prefer-find-by. Remove when NCIOCPL standards are updated. | ||
'testing-library/prefer-find-by': 'error', | ||
|
||
'jest/no-if': 'off', // Removed in eslint-plugin-jest 28. This is now no-conditional-in-test. Note: v28 and above only supports for node 20+. Remove when NCIOCPL standards are updated. | ||
'jest/no-conditional-in-test': 'error', | ||
|
||
'react/jsx-filename-extension': [1, { allow: 'always' }], | ||
}, | ||
globals: { | ||
cy: true, | ||
Cypress: true, | ||
getFixture: true, | ||
}, | ||
ignorePatterns: ['**/node_modules/***', 'build/', 'dist/', '*/node_modules/'], | ||
overrides: [ | ||
{ | ||
files: ['cypress/**'], | ||
rules: cypressRuleDisables, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
lts/gallium | ||
lts/iron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
const plugins = []; | ||
|
||
module.exports = { | ||
presets: ['react-app'], | ||
presets: [ | ||
[ | ||
'react-app', | ||
{ | ||
absoluteRuntime: false, | ||
}, | ||
], | ||
'@babel/preset-react', | ||
'@babel/preset-env', | ||
], | ||
|
||
plugins, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.