Skip to content

Build failed when used eslint-disable comments with a missing rule. #7712

Closed
@zhengxiaoyao0716

Description

@zhengxiaoyao0716

Describe the bug

When build or start the app, react-scripts would validite the code by eslint, that's great. And sometimes, we may using // eslint-disable-line some-rules to disabled validite for some lines, that's works well too.

However, sometimes, the rule of the eslint-disable comments was missing, for me, it happend when I moved a package out of a monorepo. All the eslint configurations, presets and pulgins ware set by the workspace, not in the package itself.

As the rule was missing, I'll expected the comments has no effect and the package could still works (or maybe we can got a warning), but infact it will interrupt our build and throw an error like Definition for rule 'xxx' was not found . It cause that we have to configured eslint for each package of the monorepo so that we can easlier singled out a child-package to build and test.

image

Environment

Environment Info:

System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
Binaries:
Yarn: 1.13.0 - C:\Users\zheng\AppData\Roaming\npm\yarn.CMD
npm: 6.11.3 - D:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 40.15063.674.0
Internet Explorer: 11.0.15063.850
npmPackages:
react: ^16.8.6 => 16.9.0
react-dom: ^16.8.6 => 16.9.0
react-scripts: 3.1.1 => 3.1.1
npmGlobalPackages:
create-react-app: Not Found

Steps to reproduce

Create a new project and insert a line of comments like this:

// eslint-disable-next-line MISSING_RULE

Then try to build or start the app.

Expected behavior

Maybe we can got a warning, but the project should built succeed as always.

Actual behavior

Just got an error and build failed.

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