dilanx / craco

Create React App Configuration Override, an easy and comprehensible configuration layer for Create React App.
https://craco.js.org
Apache License 2.0
7.43k stars 499 forks source link

`ESLINT_MODES` is undefined #483

Closed mhenke96 closed 1 year ago

mhenke96 commented 1 year ago

What's happening I want to set a custom eslint file according to the receipt, but @craco/craco does not export ESLINT_MODES.

What should happen @craco/craco should export ESLINT_MODES and therefore allow a custom eslint file.

To reproduce Try to import ESLINT_MODES from @craco/craco anywhere. It's clearly not exported in the index.ts. Furthermore, it just appears in the documentation when searching the entire repository: https://github.com/dilanx/craco/search?q=ESLINT_MODES

CRACO version 7.0.0

CRACO config

const { ESLINT_MODES } = require('@craco/craco');

module.exports = {
  eslint: {
    mode: ESLINT_MODES.file,
  },
};

package.json

{
  "module": "false",
  "scripts": {
    "dev": "craco start",
    "build": "craco build",
    "test": "craco test",
  },
  "dependencies": {
  },
  "devDependencies": {
    "@babel/core": "7.20.5",
    "@babel/eslint-parser": "^7.17.0",
    "@babel/preset-env": "^7.16.11",
    "@babel/preset-react": "^7.16.7",
    "@commitlint/cli": "17.3.0",
    "@commitlint/config-conventional": "17.3.0",
    "@craco/craco": "7.0.0",
    "@testing-library/dom": "^8.17.1",
    "@testing-library/jest-dom": "^5.15.0",
    "@testing-library/react": "^13.0.0",
    "@testing-library/user-event": "^14.0.0",
    "eslint": "^8.30.0",
    "eslint-config-airbnb": "^19.0.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "7.31.11",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-sonarjs": "^0.17.0",
    "eslint-plugin-testing-library": "^5.0.0",
    "husky": "^8.0.1",
    "prettier": "2.8.1",
    "serve": "14.1.2",
    "source-map-loader": "^4.0.1"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Additional information None

dilanx commented 1 year ago

Thanks for the catch. Since CRACO 7, ESLINT_MODES does not exist, and the config property should be set to either 'extends' or 'file' (as a string, see the TS interface here). The documentation does not accurately reflect that so I'll fix that soon. Sorry!

To solve your issue, just set mode to 'file'.

I'll close this issue once the docs are updated.

dilanx commented 1 year ago

The docs that still included references to ESLINT_MODES have been updated!