Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use eslint-config-airbnb without eslint-plugin-react? #451

Closed
txchen opened this issue Aug 2, 2015 · 15 comments
Closed

Can I use eslint-config-airbnb without eslint-plugin-react? #451

txchen opened this issue Aug 2, 2015 · 15 comments

Comments

@txchen
Copy link

txchen commented Aug 2, 2015

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?

@timkurvers
Copy link

I think this is being discussed over at #366.

@txchen
Copy link
Author

txchen commented Aug 5, 2015

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

@timkurvers
Copy link

Very nice, thanks for the heads-up!

@justjake
Copy link
Collaborator

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

@txchen
Copy link
Author

txchen commented Aug 21, 2015

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

@rsp
Copy link

rsp commented Jan 29, 2017

@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.

@Raulis
Copy link

Raulis commented Jan 26, 2018

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?

@ljharb
Copy link
Collaborator

ljharb commented Jan 26, 2018

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

@Raulis
Copy link

Raulis commented Jan 27, 2018

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

@ljharb
Copy link
Collaborator

ljharb commented Jan 27, 2018

It looks like you’re 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’re using also uses the local one)

@Raulis
Copy link

Raulis commented Jan 28, 2018

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)

@ljharb
Copy link
Collaborator

ljharb commented Jan 28, 2018

Have you npm installed the config locally as well?

@basickarl
Copy link

basickarl commented Jan 31, 2018

  "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

@ljharb
Copy link
Collaborator

ljharb commented Jan 31, 2018

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

@felipealvesgnu
Copy link

felipealvesgnu commented May 20, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants