Gathering detailed insights and metrics for jest-runner-eslint
Gathering detailed insights and metrics for jest-runner-eslint
Gathering detailed insights and metrics for jest-runner-eslint
Gathering detailed insights and metrics for jest-runner-eslint
npm install jest-runner-eslint
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
480 Stars
243 Commits
46 Forks
7 Watching
5 Branches
37 Contributors
Updated on 25 Nov 2024
JavaScript (99.46%)
Dockerfile (0.54%)
Cumulative downloads
Total Downloads
Last day
-8.3%
18,856
Compared to previous day
Last week
-2.4%
101,290
Compared to previous week
Last month
12.1%
411,730
Compared to previous month
Last year
-5.3%
5,243,682
Compared to previous year
4
Install jest
(it needs Jest 21+) and jest-runner-eslint
1yarn add --dev jest jest-runner-eslint 2 3# or with NPM 4 5npm install --save-dev jest jest-runner-eslint
In your package.json
1{ 2 "jest": { 3 "runner": "jest-runner-eslint", 4 "displayName": "lint", 5 "testMatch": ["<rootDir>/src/**/*.js"] 6 } 7}
Or in jest.config.js
1module.exports = { 2 runner: 'jest-runner-eslint', 3 displayName: 'lint', 4 testMatch: ['<rootDir>/src/**/*.js'], 5};
Please update testMatch
to match your project folder structure
It is recommended to use the projects
configuration option to run multiple Jest runners simultaneously.
If you are using Jest <22.0.5, you can use multiple Jest configuration files and supply the paths to those files in the projects
option. For example:
1// jest-test.config.js 2module.exports = { 3 // your Jest test options 4 displayName: 'test', 5}; 6 7// jest-eslint.config.js 8module.exports = { 9 // your jest-runner-eslint options 10 runner: 'jest-runner-eslint', 11 displayName: 'lint', 12 testMatch: ['<rootDir>/src/**/*.js'], 13};
In your package.json
:
1{ 2 "jest": { 3 "projects": [ 4 "<rootDir>/jest-test.config.js", 5 "<rootDir>/jest-eslint.config.js" 6 ] 7 } 8}
Or in jest.config.js
:
1module.exports = { 2 projects: [ 3 '<rootDir>/jest-test.config.js', 4 '<rootDir>/jest-eslint.config.js', 5 ], 6};
If you are using Jest >=22.0.5, you can supply an array of project configuration objects instead. In your package.json
:
1{ 2 "jest": { 3 "projects": [ 4 { 5 "displayName": "test" 6 }, 7 { 8 "runner": "jest-runner-eslint", 9 "displayName": "lint", 10 "testMatch": ["<rootDir>/src/**/*.js"] 11 } 12 ] 13 } 14}
Or in jest.config.js
:
1module.exports = { 2 projects: [ 3 { 4 displayName: 'test', 5 }, 6 { 7 runner: 'jest-runner-eslint', 8 displayName: 'lint', 9 testMatch: ['<rootDir>/src/**/*.js'], 10 }, 11 ], 12};
1yarn jest
--fix
in watch modejest-runner-eslint
comes with a watch plugin that allows you to toggle the --fix
value while in watch mode without having to update your configuration.
To use this watch plugin simply add this to your Jest configuration.
1{ 2 watchPlugins: ['jest-runner-eslint/watch-fix'], 3}
After this run Jest in watch mode and you will see the following line in your watch usage menu
› Press F to override ESLint --fix.
This project uses cosmiconfig, so you can provide config via:
jest-runner-eslint
property in your package.json
jest-runner-eslint.config.js
JS file.jest-runner-eslintrc
JSON fileIn package.json
1{ 2 "jest-runner-eslint": { 3 "cliOptions": { 4 // Options here 5 } 6 } 7}
or in jest-runner-eslint.config.js
1module.exports = { 2 cliOptions: { 3 // Options here 4 }, 5};
jest-runner-eslint maps a lot of ESLint CLI arguments to config options. For example --fix
is cliOptions.fix
option | default | example |
---|---|---|
cache | false | "cache": true |
cacheLocation | .eslintcache | "cacheLocation": "/path/to/cache" |
config | null | "config": "/path/to/config" |
env | null | "env": "mocha" or "env": ["mocha", "other"] |
ext | [".js"] | "ext": ".jsx" or "ext": [".jsx", ".ts"] |
fix | false | "fix": true |
fixDryRun | false | "fixDryRun": true |
format | null | "format": "codeframe" |
global | [] | "global": "it" or "global": ["it", "describe"] |
ignorePath | null | "ignorePath": "/path/to/ignore" |
ignorePattern | [] | "ignorePattern": ["/path/to/ignore/*"] |
maxWarnings | -1 | "maxWarnings": 0 |
noEslintrc | false | "noEslintrc": true |
noIgnore | false | "noIgnore": true |
noInlineConfig | false | "noInlineConfig": true |
parser | espree | "parser": "flow" |
parserOptions | {} | "parserOptions": { "myOption": true } |
plugin | [] | "plugin": "prettier" or "plugin": ["prettier", "other"] |
quiet | false | "quiet": true |
resolvePluginsRelativeTo | undefined | "resolvePluginsRelativeTo": "./eslint-config" |
reportUnusedDisableDirectives | false | "reportUnusedDisableDirectives": true |
rules | {} | "rules": {"quotes": [2, "double"]} or "rules": {"quotes": [2, "double"], "no-console": 2} |
rulesdir | [] | "rulesdir": "/path/to/rules/dir" or "rulesdir": ["/path/to/rules/dir", "/path/to/other"] |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
16 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More