AtomLinter / linter-eslint

ESLint plugin for Atom Linter
https://atom.io/packages/linter-eslint
584 stars 141 forks source link

Not working with `create-react-app` #1458

Closed ckirk closed 2 years ago

ckirk commented 2 years ago

Issue Type

Bug

Issue Description

When creating a new app with create-react-app, linting in atom isn't working. Linting works fine from CLI, browser output, etc. which leads me to believe this is an issue with linter-eslint itself.

In atom I get the following error:

Error while running ESLint: package.json » eslint-config-react-app/jest#overrides[0]:.

If I remove react-app/jest from eslintConfig in package.json, I get the following error:

Error while running ESLint: Failed to load plugin 'import' declared in 'package.json » eslint-config-react-app': Invalid URL: eslintrc.cjs.

create-react-app is supposed to have linting with eslint pre-configured out of the box. It includes eslint and all configurations as dependencies. create-react-app's eslint configuration is broken out into its own package called eslint-config-react-app and comes pre-packaged with create-react-app

I've also tried including the eslint-config-react-app configuration in a non create-react-app project and get the same errors.

I do not have eslint installed globally.

Bug Checklist

Package.json

{
  "name": "cra-estlint-test",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

linter-eslint debugging information

Atom version: 1.59.0
linter-eslint version: 9.0.0
ESLint version: 8.8.0
Hours since last Atom restart: 0
Platform: darwin
Using local project ESLint from: /Users/chris/code/cra-estlint-test/node_modules/eslint
Current file's scopes: [
  "source.flow",
  "entity.other.attribute-name"
]
linter-eslint configuration: {
  "advanced": {
    "disableEslintIgnore": false,
    "disableFSCache": false,
    "showRuleIdInMessage": true,
    "eslintRulesDirs": [],
    "localNodeModules": ""
  },
  "disabling": {
    "disableWhenNoEslintConfig": false,
    "rulesToSilenceWhileTyping": []
  },
  "scopes": [
    "source.js",
    "source.jsx",
    "source.js.jsx",
    "source.flow",
    "source.babel",
    "source.js-semantic"
  ],
  "lintHtmlFiles": false,
  "autofix": {
    "fixOnSave": false,
    "ignoreFixableRulesWhileTyping": false,
    "rulesToDisableWhileFixing": []
  },
  "global": {
    "useGlobalEslint": false,
    "eslintrcPath": "",
    "globalNodePath": ""
  }
}
ckirk commented 2 years ago

Update: create-react-app currently uses eslint v8. Apparently linter-eslint doesn't fully support eslint v8 yet and can't be upgraded properly until Atom starts bundling a more recent version of node??

This is kind of a big problem. Did everyone jump ship to VS Code?

emrea-works commented 2 years ago

I didin't jump to anywhere else, I have the similar issue, cli linting is enough for now. If I can have more time, I'll look forward how to fix it.

UziTech commented 2 years ago

We just released linter-eslint-node which should work with eslint v8. We created a new package for this because it required many breaking changes and we want people using linter-eslint successfully with older versions of eslint to be able to continue using it.

joanned commented 2 years ago

We just released linter-eslint-node which should work with eslint v8. We created a new package for this because it required many breaking changes and we want people using linter-eslint successfully with older versions of eslint to be able to continue using it.

That link is not working