Javascript: Can I use eslint-config-airbnb without eslint-plugin-react?

Created on 2 Aug 2015  路  15Comments  路  Source: airbnb/javascript

I am not using react, so it would be better for me to just install eslint.

Is it possible to move the jsx related configs to a separated file?

Most helpful comment

the official package now has a react-free version (as of v0.0.8)!

simpy npm install --save-dev eslint-config-airbnb and add { "extends": "airbnb/base" } to your .eslintrc

see here: https://www.npmjs.com/package/eslint-config-airbnb

All 15 comments

I think this is being discussed over at #366.

I actually created a package for this: https://github.com/txchen/eslint-config-airbnb-lite

Very nice, thanks for the heads-up!

the official package now has a react-free version (as of v0.0.8)!

simpy npm install --save-dev eslint-config-airbnb and add { "extends": "airbnb/base" } to your .eslintrc

see here: https://www.npmjs.com/package/eslint-config-airbnb

@justjake that's sweet! thanks for the information!

@justjake @txchen Using "extends": "airbnb/base" in .eslintrc is deprecated, see:

Currently the way to avoid using eslint-plugin-react is to use eslint-config-airbnb-base, see:

It requires only eslint and eslint-plugin-import as peer deps and you use it with "extends": "airbnb-base" in .eslintrc - or with "extends": "airbnb-base/legacy" for ES5 and below.

Hi all, maybe you will know what I did wrong... @rsp
after doing all this (https://www.npmjs.com/package/eslint-config-airbnb-base) I get this error:
image
What does that mean?

Not sure where that error comes from; does it work on the command line?

hello @ljharb !
I get the same error just more stuff. I am new at this. Not really know much about terminal and stuff.
image

It looks like you鈥檙e running a global eslint; try uninstalling that one and running the local one through an npm run-script (be sure any editor or IDE you鈥檙e using also uses the local one)

hmm... I tried like this: ./node_modules/.bin/eslint js.js

Get the same error, not sure what I am doing wrong here.

Cannot find module 'eslint-config-airbnb-base'
Referenced from: Y:\Google drive\www\projektai\portfolio\.eslintrc
Error: Cannot find module 'eslint-config-airbnb-base'
Referenced from: Y:\Google drive\www\projektai\portfolio\.eslintrc
    at ModuleResolver.resolve (Y:\Google drive\www\projektai\portfolio\node_modules\eslint\lib\util\module-resolver.js:74:19)
    at resolve (Y:\Google drive\www\projektai\portfolio\node_modules\eslint\lib\config\config-file.js:515:25)
    at load (Y:\Google drive\www\projektai\portfolio\node_modules\eslint\lib\config\config-file.js:584:26)
    at configExtends.reduceRight (Y:\Google drive\www\projektai\portfolio\node_modules\eslint\lib\config\config-file.js:421:36)
    at Array.reduceRight (<anonymous>)
    at applyExtends (Y:\Google drive\www\projektai\portfolio\node_modules\eslint\lib\config\config-file.js:403:28)
    at loadFromDisk (Y:\Google drive\www\projektai\portfolio\node_modules\eslint\lib\config\config-file.js:556:22)
    at Object.load (Y:\Google drive\www\projektai\portfolio\node_modules\eslint\lib\config\config-file.js:592:20)
    at Config.getLocalConfigHierarchy (Y:\Google drive\www\projektai\portfolio\node_modules\eslint\lib\config.js:226:44)
    at Config.getConfigHierarchy (Y:\Google drive\www\projektai\portfolio\node_modules\eslint\lib\config.js:180:43)

Have you npm installed the config locally as well?

  "devDependencies": {
    "eslint": "^4.16.0",
    "eslint-config-airbnb-base": "^12.1.0",
    "eslint-plugin-import": "^2.8.0",
    "mocha": "^5.0.0",
    "nyc": "^11.4.1",
    "squel": "^5.12.0"
  }
{
    "extends": "airbnb-base",
    "env": {
        "es6": true,
        "mocha": true,
        "node": true
    },
    "rules": {
        "indent": [
            "error",
            4
        ]
    }
}
[Error - 11:21:03] Cannot find module 'eslint-config-airbnb/base' Referenced from: /Users/karl/dev/prn/.eslintrc.json

And does eslintrc.json have a slash in it or a hyphen?

@ljharb Add "extends": "airbnb-base" with hyphen

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kozhevnikov picture kozhevnikov  路  3Comments

koiralakiran1 picture koiralakiran1  路  3Comments

ar
mbifulco picture mbifulco  路  3Comments

weihongyu12 picture weihongyu12  路  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  路  3Comments