All Projects → jest-community → Jest Runner Eslint

jest-community / Jest Runner Eslint

Licence: mit
An ESLint runner for Jest

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Jest Runner Eslint

Ebikes Lwc
Sample application for Lightning Web Components and Communities on Salesforce Platform. Part of the sample gallery. Retail use case. Get inspired and learn best practices.
Stars: ✭ 299 (-25.44%)
Mutual labels:  jest
Pwa
An opinionated progressive web app boilerplate
Stars: ✭ 353 (-11.97%)
Mutual labels:  jest
Nx Examples
Example repo for nx workspace
Stars: ✭ 372 (-7.23%)
Mutual labels:  jest
Jest Junit
A Jest reporter that creates compatible junit xml files
Stars: ✭ 307 (-23.44%)
Mutual labels:  jest
Electron React Boilerplate
A Foundation for Scalable Cross-Platform Apps
Stars: ✭ 18,727 (+4570.07%)
Mutual labels:  jest
Nod
Node.js module generator/boilerplate with Babel, Jest, Flow, Documentation and more
Stars: ✭ 355 (-11.47%)
Mutual labels:  jest
React Bolt
⚡ The most simple & robust boilerplate for your React projects.
Stars: ✭ 298 (-25.69%)
Mutual labels:  jest
Enzyme
JavaScript Testing utilities for React
Stars: ✭ 19,781 (+4832.92%)
Mutual labels:  jest
Jest Cucumber
Execute Gherkin scenarios in Jest
Stars: ✭ 347 (-13.47%)
Mutual labels:  jest
Baretest
An extremely fast and simple JavaScript test runner.
Stars: ✭ 364 (-9.23%)
Mutual labels:  jest
Coderplanets web
the most sexiest community for developers, build with React, Mobx/MST, GraphQL, Styled-Components, Rxjs, Ramda ... and ❤️
Stars: ✭ 314 (-21.7%)
Mutual labels:  jest
Jest Mongodb
Jest preset for MongoDB in-memory server
Stars: ✭ 323 (-19.45%)
Mutual labels:  jest
Shop
🛍🛒 Full-stack React/Prisma/TS/GraphQL E-Commerce Example
Stars: ✭ 359 (-10.47%)
Mutual labels:  jest
React Redux Boilerplate
Awesome React Redux Workflow Boilerplate with Webpack 4
Stars: ✭ 307 (-23.44%)
Mutual labels:  jest
Typescript Library Starter
Starter kit with zero-config for building a library in TypeScript, featuring RollupJS, Jest, Prettier, TSLint, Semantic Release, and more!
Stars: ✭ 3,943 (+883.29%)
Mutual labels:  jest
Front End
Operation Code's website
Stars: ✭ 301 (-24.94%)
Mutual labels:  jest
Webpack React Boilerplate
Minimal React 16 and Webpack 4 boilerplate with babel 7, using the new webpack-dev-server, react-hot-loader, CSS-Modules
Stars: ✭ 358 (-10.72%)
Mutual labels:  jest
Gatsby Starter
Gatsby 2.0 starter with typescript and many cools dev tools
Stars: ✭ 385 (-3.99%)
Mutual labels:  jest
Js Stack From Scratch
🛠️⚡ Step-by-step tutorial to build a modern JavaScript stack.
Stars: ✭ 18,814 (+4591.77%)
Mutual labels:  jest
Mercury Parser
📜 Extract meaningful content from the chaos of a web page
Stars: ✭ 4,025 (+903.74%)
Mutual labels:  jest

Build Status npm version

jest-runner-eslint

ESLint runner for Jest

Usage

Install

Install jest(it needs Jest 21+) and jest-runner-eslint

yarn add --dev jest jest-runner-eslint

# or with NPM

npm install --save-dev jest jest-runner-eslint

Add it to your Jest config

Standalone

In your package.json

{
  "jest": {
    "runner": "jest-runner-eslint",
    "displayName": "lint",
    "testMatch": ["<rootDir>/src/**/*.js"]
  }
}

Or in jest.config.js

module.exports = {
  runner: 'jest-runner-eslint',
  displayName: 'lint',
  testMatch: ['<rootDir>/src/**/*.js'],
};

Please update testMatch to match your project folder structure

Alongside other runners

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:

// jest-test.config.js
module.exports = {
  // your Jest test options
  displayName: 'test',
};

// jest-eslint.config.js
module.exports = {
  // your jest-runner-eslint options
  runner: 'jest-runner-eslint',
  displayName: 'lint',
  testMatch: ['<rootDir>/src/**/*.js'],
};

In your package.json:

{
  "jest": {
    "projects": [
      "<rootDir>/jest-test.config.js",
      "<rootDir>/jest-eslint.config.js"
    ]
  }
}

Or in jest.config.js:

module.exports = {
  projects: [
    '<rootDir>/jest-test.config.js',
    '<rootDir>/jest-eslint.config.js',
  ],
};

If you are using Jest >=22.0.5, you can supply an array of project configuration objects instead. In your package.json:

{
  "jest": {
    "projects": [
      {
        "displayName": "test"
      },
      {
        "runner": "jest-runner-eslint",
        "displayName": "lint",
        "testMatch": ["<rootDir>/src/**/*.js"]
      }
    ]
  }
}

Or in jest.config.js:

module.exports = {
  projects: [
    {
      displayName: 'test',
    },
    {
      runner: 'jest-runner-eslint',
      displayName: 'lint',
      testMatch: ['<rootDir>/src/**/*.js'],
    },
  ],
};

Run Jest

yarn jest

Toggle --fix in watch mode

jest-eslint-runner comes with a watch plugin that allows you to toggle the --fix value while in watch mode without having to update your configuration.

fix

To use this watch plugin simply add this to your Jest configuration.

{
  watchPlugins: ['jest-runner-eslint/watch-fix'],
}

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.

Options

This project uses cosmiconfig, so you can provide config via:

  • a jest-runner-eslint property in your package.json
  • a jest-runner-eslint.config.js JS file
  • a .jest-runner-eslintrc JSON file

In package.json

{
  "jest-runner-eslint": {
    "cliOptions": {
      // Options here
    }
  }
}

or in jest-runner-eslint.config.js

module.exports = {
  cliOptions: {
    // Options here
  },
};

cliOptions

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": ["pettier", "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 "env": ["/path/to/rules/dir", "/path/to/other"]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].