0

Create-react-app allows you to extend the ESLint config that comes with create-react-app:

https://create-react-app.dev/docs/setting-up-your-editor#experimental-extending-the-eslint-config

However when I try to do this in my own project i just get this error (Image of error)

Error

Error: Cannot find module 'eslint-config-shared-config'

Command run

eslint --ignore-path .gitignore --ext .js,.ts,.tsx .

.eslintrc

{
  "extends": ["react-app", "shared-config"],
  "rules": {
    "additional-rule": "warn"
  },
  "overrides": [
    {
      "files": ["**/*.ts?(x)"],
      "rules": {
        "additional-typescript-only-rule": "warn"
      }
    }
  ]
}
Community
  • 1
  • 1

1 Answers1

0

A safe way to setup a base ESLint config file to build upon is by following the ESLint usage guide

$ npx eslint --init
# or
$ yarn run eslint --init

Like @jonrsharpe said, shared-config is just an example that cannot be used literally, the docs was trying to explain that you could use shared configurations.

For example, if you add an ESLint plugin with a shared-config rule set, then you could use that as indicated by the example.

Difference between plugins and extends in ESLint

EXTEND_ESLINT flag was removed in react-scripts v4

piouson
  • 3,328
  • 3
  • 29
  • 29