Neutrino middleware for linting source code using ESLint

This package is deprecated. See:
Last updated 3 years ago by eliperelman .
MPL-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install neutrino-middleware-eslint 
SYNC missed versions from official npm registry.

Neutrino ESLint Middleware

neutrino-middleware-eslint is Neutrino middleware for linting source code using ESLint and eslint-loader.

NPM version NPM downloads Join the Neutrino community on Spectrum


  • Node.js v6.10+
  • Yarn or npm client
  • Neutrino v7


neutrino-middleware-eslint can be installed via the Yarn or npm clients.


❯ yarn add neutrino-middleware-eslint


❯ npm install --save neutrino-middleware-eslint


neutrino-middleware-eslint can be consumed from the Neutrino API, middleware, or presets. Require this package and plug it into Neutrino:

// Using function middleware format
const eslint = require('neutrino-middleware-eslint');

// Usage shows default values
neutrino.use(eslint, {
  test: /\.(js|jsx)$/,
  include: [], /* Should specify either include or exclude */
  exclude: [], /* Should specify either include or exclude */
  eslint: {
    cwd: neutrino.options.root,
    useEslintrc: false,
    root: true,
    extensions: ['js', 'jsx'],
    plugins: ['babel'],
    baseConfig: {},
    envs: ['es6'],
    parser: 'babel-eslint',
    parserOptions: {
      ecmaVersion: 2017,
      sourceType: 'module',
      ecmaFeatures: {
        objectLiteralDuplicateProperties: false,
        generators: true,
        impliedStrict: true
    settings: {},
    globals: ['process'],
    rules: {}
  • test: Test which files should be linted.
  • include: An array of paths to include in linting. Maps to Webpack's Rule.include
  • exclude: An array of paths to exclude from linting. Maps to Webpack's Rule.exclude
  • eslint: An ESLint CLIEngine configuration object for configuring ESLint. Use this to configure rules, plugins, and other ESLint options.


neutrino-middleware-eslint creates some conventions to make overriding the configuration easier once you are ready to make changes.


The following is a list of rules and their identifiers which can be overridden:

Name Description Environments and Commands
lint By default, lints JS and JSX files from included directories using ESLint. Contains a single loader named eslint. all


By default this middleware will show errors and warnings in the console during development, and will cause a failure when creating a build bundle.

If you want your preset or middleware to also extend from another ESLint configuration or preset that you have made a dependency, you must use baseConfig.extends rather than just extends. This is a limitation of ESLint, not this middleware.

This middleware only configures a target environment for es6, leaving other build middleware free to add their own target environments. If your middleware puts restrictions on which environments it is capable of running, please document that clearly in your middleware.

eslint CLI

This is the recommended way to perform a one-off lint in a Neutrino project.

You can also have Neutrino invoke ESLint for you if you wish to perform a one-time lint. This avoids needing to install ESLint manually, creating a .eslintrc.js file, or having to manage includes and ignores. As long as the ESLint middleware is loaded, you have access to a command to run ESLint from the command line.

This middleware registers a command named lint which programmatically calls ESLint and prints the results to the console.

❯ neutrino lint
❯ neutrino lint --fix

eslintrc Config

If you cannot or do not wish to use Neutrino to execute one-off linting, you can still use ESLint manually.

neutrino-middleware-eslint also provides a method for getting the ESLint configuration suitable for use in an eslintrc file. Typically this is used for providing hints or fix solutions to the development environment, e.g. IDEs and text editors. Doing this requires creating an instance of the Neutrino API and providing the middleware it uses. If you keep all this information in a .neutrinorc.js, this should be relatively straightforward. By providing all the middleware used to Neutrino, you can ensure all the linting options used across all middleware will be merged together for your development environment, without the need for copying, duplication, or loss of organization and separation.

This middleware registers another command named eslintrc which returns an ESLint configuration object suitable for consumption by the ESLint CLI. Use the Neutrino API's call method to invoke this command:

Example: Create a .eslintrc.js file in the root of the project, using .neutrinorc.js middleware.

// .eslintrc.js

// If you do not specify any middleware to call(),
// it will use the local .neutrinorc.js file

const { Neutrino } = require('neutrino');

module.exports = Neutrino().call('eslintrc');

Example: Create a .eslintrc.js file in the root of the project, using specified middleware.

// .eslintrc.js
const { Neutrino } = require('neutrino');

module.exports = Neutrino().call('eslintrc', [
  ['neutrino-middleware-eslint', {
    eslint: {
      rules: { semi: 'off' }

If you are able, only use a .eslintrc.js file for editor hints, and use the Neutrino lint command for one-off linting or fixes.

Projects may face a problem when their editor or IDE lints all files and highlights errors that were normally excluded from source, i.e. Neutrino's include and exclude options. This is because the ESLint CLI does not have a way to specify included and excluded files from configuration. If you still wish to use ESLint's CLI for linting, consider setting CLI flags or using an eslintignore to choose which files to include or exclude from linting.

Unfortunately ESLint does not provide the possibility to configure ignored paths from Neutrino configuration and exclude them from linting. Projects authors should define this manually in their project root directory in a .eslintignore file. This is one of the main reasons to prefer using the lint CLI command with this middleware, as it avoids a lot of manual configuration and boilerplate.

.eslintignore file:


ESLint will exclude built files and any files in the root directory (e.g. custom Neutrino configuration) but src and test folders will be still checked. node_modules are ignored by default in ESLint. More information can be found in the ESLint user guide.


This middleware is part of the neutrino-dev repository, a monorepo containing all resources for developing Neutrino and its core presets and middleware. Follow the contributing guide for details.

Current Tags

  • 7.4.0                                ...           latest (3 years ago)

45 Versions

  • 7.4.0 [deprecated]           ...           3 years ago
  • 7.3.3 [deprecated]           ...           3 years ago
  • 7.3.2 [deprecated]           ...           3 years ago
  • 7.3.1 [deprecated]           ...           3 years ago
  • 7.3.0 [deprecated]           ...           3 years ago
  • 7.2.3 [deprecated]           ...           3 years ago
  • 7.2.1 [deprecated]           ...           3 years ago
  • 7.1.10 [deprecated]           ...           3 years ago
  • 7.1.3 [deprecated]           ...           3 years ago
  • 7.1.2 [deprecated]           ...           3 years ago
  • 7.1.1 [deprecated]           ...           3 years ago
  • 7.1.0 [deprecated]           ...           3 years ago
  • 7.0.2 [deprecated]           ...           3 years ago
  • 7.0.1 [deprecated]           ...           3 years ago
  • 7.0.0 [deprecated]           ...           3 years ago
  • 6.2.1 [deprecated]           ...           3 years ago
  • 6.2.0 [deprecated]           ...           3 years ago
  • 6.1.8 [deprecated]           ...           3 years ago
  • 6.1.5 [deprecated]           ...           3 years ago
  • 6.1.4 [deprecated]           ...           3 years ago
  • 6.1.3 [deprecated]           ...           3 years ago
  • 6.1.2 [deprecated]           ...           3 years ago
  • 6.1.1 [deprecated]           ...           3 years ago
  • 6.1.0 [deprecated]           ...           3 years ago
  • 6.0.5 [deprecated]           ...           3 years ago
  • 6.0.4 [deprecated]           ...           3 years ago
  • 6.0.3 [deprecated]           ...           3 years ago
  • 6.0.2 [deprecated]           ...           3 years ago
  • 6.0.1 [deprecated]           ...           3 years ago
  • 6.0.0 [deprecated]           ...           3 years ago
  • 5.9.0 [deprecated]           ...           3 years ago
  • 5.8.0 [deprecated]           ...           3 years ago
  • 5.7.0 [deprecated]           ...           4 years ago
  • 5.6.0 [deprecated]           ...           4 years ago
  • 5.5.1 [deprecated]           ...           4 years ago
  • 5.5.0 [deprecated]           ...           4 years ago
  • 5.4.0 [deprecated]           ...           4 years ago
  • 5.3.1 [deprecated]           ...           4 years ago
  • 5.3.0 [deprecated]           ...           4 years ago
  • 5.2.0 [deprecated]           ...           4 years ago
  • 5.1.0 [deprecated]           ...           4 years ago
  • 5.0.2 [deprecated]           ...           4 years ago
  • 5.0.1 [deprecated]           ...           4 years ago
  • 5.0.0 [deprecated]           ...           4 years ago
  • 5.0.0-beta.1                                ...           4 years ago

Copyright 2014 - 2017 © |