Skip to content

Option to disable ESLint in specific contexts (but not everywhere) #9929

Closed
@jrr

Description

@jrr

Is your proposal related to a problem?

On my project, ESLint's feedback is most valuable from 1) our editors, and 2) CI. It's not very useful when lint errors appear in the browser when connected to the dev server. (in fact, it slows me down!)

Describe the solution you'd like

I'd like to disable ESLint in the dev server, without affecting how ESLint behaves in other contexts. (e.g., eslint on the command line and in VS Code should be unafffected).

This could be via an environment var, e.g. DISABLE_LINT=1 react-scripts start.

Describe alternatives you've considered

I've looked through react-script's webpack config to check if there was already a way to do this, but couldn't find one:

new ESLintPlugin({
// Plugin options
extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
context: paths.appSrc,
cache: true,
// ESLint class options
cwd: paths.appPath,
resolvePluginsRelativeTo: __dirname,
baseConfig: {
extends: [require.resolve('eslint-config-react-app/base')],
rules: {
...(!hasJsxRuntime && {
'react/react-in-jsx-scope': 'error',
}),
},
},
}),

I've also looked into whether there was already a global disable available from ESLint or its webpack plugin, and couldn't find anything.

Additional context

I know CRA aims to limit the available configuration options, but it seems reasonable for this one to go in Advanced Configuration.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions