Giter Site home page Giter Site logo

eslint-config-defaults's Introduction


NOTICE:

This repository has been archived and is not supported.

No Maintenance Intended


NOTICE: SUPPORT FOR THIS PROJECT HAS ENDED

This projected was owned and maintained by Walmart. This project has reached its end of life and Walmart no longer supports this project.

We will no longer be monitoring the issues for this project or reviewing pull requests. You are free to continue using this project under the license terms or forks of this project at your own risk. This project is no longer subject to Walmart's bug bounty program or other security monitoring.

Actions you can take

We recommend you take the following action:

  • Review any configuration files used for build automation and make appropriate updates to remove or replace this project
  • Notify other members of your team and/or organization of this change
  • Notify your security team to help you evaluate alternative options

Forking and transition of ownership

For security reasons, Walmart does not transfer the ownership of our primary repos on Github or other platforms to other individuals/organizations. Further, we do not transfer ownership of packages for public package management systems.

If you would like to fork this package and continue development, you should choose a new name for the project and create your own packages, build automation, etc.

Please review the licensing terms of this project, which continue to be in effect even after decommission.

This project is DEPRECATED. It has been replaced by more specific projects.

When I started this project, I wanted eslint-config-defaults to be the easiest way to get started with eslint and as a part of that I wanted to have lots of options for people. At the time the extends feature was brand new and very few people were using it and some of this config, like Google's was not available in other places. Since then, many many companies including eslint itself began publishing their own eslint-config-<name>. I think this project served it’s purpose (promoting eslint and the use of the extention feature) but now we don’t need a one stop shop. This project is no longer maintained. Updated config can be grabbed at the individual project repos.


eslint-config-defaults

A composable set of ESLint configurations.


Installation

Install this config package and ESLint:

$ npm install --save-dev eslint eslint-config-defaults

Usage

Full Configurations

This package includes the following complete and ready to use configurations:

  • defaults - The config recommended by ESLint
  • defaults/configurations/eslint - The config recommended by ESLint
  • defaults/configurations/google - The Google JavaScript Style Guide
  • defaults/configurations/gulp - The Gulp ESLint config
  • defaults/configurations/node-runtime - The config used for the Node.js runtime
  • defaults/configurations/off - Disable all rules (ESLint's default at 1.0.0+)
  • defaults/configurations/airbnb/es5 - Config from the AirBnB Style Guide
  • defaults/configurations/airbnb/es6-react - Config from the AirBnB Style Guide
  • defaults/configurations/airbnb/es6 - Config from the AirBnB Style Guide
  • defaults/configurations/walmart/es5-browser - Walmart ES5 + browser
  • defaults/configurations/walmart/es5-node - Walmart ES5 + node < 4.x
  • defaults/configurations/walmart/es5-test - Walmart ES5 + test
  • defaults/configurations/walmart/es5 - Walmart ES5 config
  • defaults/configurations/walmart/es6-browser - Walmart ES6 + browser
  • defaults/configurations/walmart/es6-node - Walmart ES6 + node 4.x
  • defaults/configurations/walmart/es6-react-test - Walmart ES6 + react + test
  • defaults/configurations/walmart/es6-react - Walmart ES6 + react
  • defaults/configurations/walmart/es6-test - Walmart ES6 + test
  • defaults/configurations/walmart/es6 - Walmart ES6 config
Dependencies

To consume and extend a config in ESLint just add the extends attribute to your .eslintrc. For more details about how shareable configs work, see the ESLint documentation.

---
"extends":
  - "defaults"
---
"extends":
  - "defaults/configurations/walmart/es6-browser"

NOTE: Extending multiple complete configs can cause unexpected results, if you need to do this you should consider a piecemeal config as explained below. See #38 for details.

Piecemeal Configurations

ESLint configuration is broken apart in ./rules containing ESLint's rules and rules for specific ESLint plugins. The full set of ESLint rules (./rules/eslint) are broken into categories that mirror ESLint's documentation. Under each rule type there are sets of configuration as well as an off.js file which turns off every rule in the category.

Examples
---
"extends":
  - "defaults/rules/eslint/best-practices/walmart",
  - "defaults/rules/eslint/errors/airbnb"

  - "defaults/rules/eslint/es6/off"
  - "defaults/rules/eslint/node/off"

"env":
  "phantom": true

Limitations

Due to an issue with ESLint, config extension cannot be called from a globally installed (npm install -g eslint) eslint. It can however be run properly using eslint installed directly to your package's node_modules. This can be done by either calling it directly (./node_modules/.bin/eslint .) or from within an npm script since they automatically check local node_modules first. This will be tracked in issue #43.

This package tracks config in the following versions:

And A Special Thanks To


License

MIT License

eslint-config-defaults's People

Contributors

baer avatar cwstege avatar ianvs avatar jchip avatar kevinoid avatar lkrnac avatar mmonto7 avatar rtorino avatar ryan-roemer avatar travi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eslint-config-defaults's Issues

Remove `environments`

In lieu of direct configs in the configurations files.

  • Replace in configurations files.
  • Revise all documentation.

Error: Cannot find module 'eslint-config-defaults/configurations/airbnb'

I've installed eslint-config-defaults and created .eslintrc file in the root of my project directory. This is the content of my .eslintrc file:

{
  "extends": "defaults"
}

When I ran eslint on my project directory, I got the following error:

Error: Cannot find module 'eslint-config-defaults/configurations/airbnb'

I am using node v0.12.7, npm v2.11.3 and eslint v0.24.1

rules/eslint/style/walmart.js not compatible with strict mode, though marked as such

rules/eslint/style/walmart.js contains a duplicate field name:

"space-before-keywords": 0,
// require or disallow space before blocks
"space-before-blocks": [2, "always"],
// require or disallow space before function opening parenthesis
"space-before-function-paren": [2, {"anonymous": "always", "named": "never" }],
// require a space before certain keywords (fixable)
"space-before-keywords": [2, "always"],

GIving the following error when running eslint:

/src/scripts/provision-test-environment/node_modules/eslint-config-defaults/rules/eslint/style/walmart.js:122
"space-before-keywords": [2, "always"],
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Cannot read config package: eslint-config-defaults/rules/eslint/style/walmart
Error: Duplicate data property in object literal not allowed in strict mode

BUG: Can't use `configurations` from command line.

Maybe PEBCAK, but this fails for me:

$ eslint -c node_modules/eslint-config-defaults/configurations/walmart/es5-node.js *.js

with:

YAMLException: Cannot read config file: /Users/rye/scm/fmd/formidable-react-component-boilerplate/node_modules/eslint-config-defaults/configurations/walmart/es5-node.js
Error: JS-YAML: end of the stream or a document separator is expected at line 1, column 13:
    "use strict";

Replace lodash merge with actual `eslint`'s `util.mergeConfig` via `extends`.

There are some subtle differences with how eslint extend's configs vs. a brute force _.merge(). (E.g., plugins are special-cased and handled differently than normal keys).

We should look to use eslint's first class extends + under-the-hood mergeConfig, especially once eslint comes in as a devDependency so that we don't accidentally queue up subtle merge bugs later (wherein composed configurations here would behave differently than library uses doing extends of the same underlying configs manually).

`extends` requires target to be JSON/JS

After the 5.0 YAML change, things are broke. More specifically, when specifying extends: "eslint-config-defaults/configurations/walmart/es6-node.yaml", ESlint will always treat the target as a JS module (see here and here). This worked with JSON because require("path/to/json/file.json") works in Node.

This seems a limitation in ESlint itself, and should be fixed there. But adding this here for now while I'm thinking of it.

Short term solution would be to revert to JSON, or to instruct users to stick to 4.x.x package versions until things are worked out.

Update for eslint-plugin-filenames 1.x

The latest plugin no longer references the single filenames/filenames rule, but rather has three separate rules:

"filenames/filenames": 2

should become:

"filenames/match-regex": 2,
"filenames/match-exported": 2,
"filenames/no-index": 2

ESLint Bug: extended config does not work with globally installed eslint

When running lint (eslint .) from a globally installed version of eslint (npm install -g eslint) you will get the following error. This appears to be a problem with ESLint itself.

package.json

dependencies: {
  "eslint-config-defaults": "^7.x.x",
  "eslint": "^1.10.3"
}
eslint .
/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:332
            throw e;
            ^

Error: Cannot read config package: eslint-config-defaults/configurations/walmart/es6-browser
Error: Cannot find module 'eslint-config-defaults/configurations/walmart/es6-browser'
Referenced from: /Users/ebaer/dev/tmp/builder-test/.eslintrc
    at Function.Module._resolveFilename (module.js:327:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)
    at loadPackage (/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:168:16)
    at loadConfigFile (/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:212:18)
    at load (/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:385:18)
    at /Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:326:36
    at Array.reduceRight (native)
    at applyExtends (/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:309:28)

Workarounds:

  • Run the version of eslint inside your project's node_modules: ./node_modules/.bin/eslint .
  • Use npm scripts since they automatically check local node_modules first: npm run lint
scripts: {
  "lint": "eslint ."
}

docs(error): AirBnb/ES6 requires `eslint-plugin-react` and `babel-eslint`

Hi Ryan,

I'm building a Yeoman generator that uses a few of the eslint plugins in this package, and just started my integration testing. I'm getting Cannot find module 'eslint-plugin-react' warnings when using this config:

{
  "extends": "defaults/configurations/airbnb/es6"
}

The way I read current readme.md, it indicates that there is no additional dependencies required for this config.

Adding both eslint-plugin-react and babel-eslint fixes the issue.

walmart config

Hey how do i get the configs for walmart loading cards??

Add AirBnB config without the eslint-plugin-react dependency

Hi there,

First, thanks for doing this - it's saved me a lot of time setting up a linter!

I'm doing an ES6 that doesn't have React (I know, weird). When I tried the naive config:

{
 "extends": "defaults/configurations/airbnb",
 "rules": {
   "no-unused-vars": [1, {"vars": "all", "args": "after-used"}]
 }
}

then I get the following error:

ERROR in ./lib/reevoo-ping.js
Module build failed: Error: Cannot find module 'eslint-plugin-react'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at /Users/jonny/reevoo/reevoo-ping-js/node_modules/eslint/lib/cli-engine.js:125:26
    at Array.forEach (native)
    at loadPlugins (/Users/jonny/reevoo/reevoo-ping-js/node_modules/eslint/lib/cli-engine.js:116:21)
    at processText (/Users/jonny/reevoo/reevoo-ping-js/node_modules/eslint/lib/cli-engine.js:204:5)
    at CLIEngine.executeOnText (/Users/jonny/reevoo/reevoo-ping-js/node_modules/eslint/lib/cli-engine.js:686:26)
    at lint (/Users/jonny/reevoo/reevoo-ping-js/node_modules/eslint-loader/index.js:26:20)
    at Object.module.exports (/Users/jonny/reevoo/reevoo-ping-js/node_modules/eslint-loader/index.js:127:7)

I'm not using React, so this was a bit weird for me. I found that the AirBnB ruleset has a set of React rules by default, which seems to trigger the error.

To fix this for my project I just copied that ruleset, but without the React ruleset in it.

I'm wondering if:

  • I'm the special one who wants the AirBnB configuration, but not the React stuff?
  • Whether there's a need for a React-less AirBnB ruleset?

Thanks!

Using both React and test configs clobbers some rules

Just came across this when updating our Formidable & Victory component boilerplates. We potentially need to add an es6-react-test config.

Let's say you want to write React tests, so your .eslintrc-client-test would have something like:


---
extends:
  - "defaults/configurations/walmart/es6-react"
  - "defaults/configurations/walmart/es6-test"
  - ".eslintrc-base"
globals:
  expect: false

The problem is that es6-react and es6-test both extend es6, and so the latter config's es6 extend will undo some of the rules overridden in the former config. (In the above case, no-extra-parens is reverted).

So it seems that for correct behavior you MUST extend only one configuration from this repo at a time – and as a result, we should add es6-react-test (or es6-test-react).

/cc @ryan-roemer @baer

Switch all properties in JS configs to double quotes.

Normally, it is an open issue / team preference to do double vs. single quotes. However, I can see a very common use case of someone wanting to copy and paste segments of some of the configs in this repo into either JS or JSON. If we switch to (and enforce) double quotes this will work seamlessly.

Any interest in tracking Node.js core style?

Although it's not currently packaged as a shareable config, the style used by the Node core team may be of interest, particularly for code which provides polyfills for Node features (either planned features or backports), but also generally for code which runs on Node.

Would that fall within this project's scope? If so, is there any interest in including it? If so, I could work up a PR.

Thanks for considering,
Kevin

Have a problem with display name property

config file

{
  "extends": "defaults/configurations/airbnb/es6-react",
  "plugins": [
    "react"
  ],
  "rules" : {
    "no-case-declarations": 0
  }
}

I already tried with "react/display-name": [0, { "ignoreTranspilerName": false, "acceptTranspilerName": false }] or without it — same result
Error message

Error: defaults/rules/react/airbnb:
    Configuration for rule "react/display-name" is invalid:
    Value "data["0"].acceptTranspilerName" has additional properties.

Update for eslint 3

Not sure if this conversation should be tied to #69 - but it would be great to update this project to support the latest definitions. As of writing, there appears to be a few out of date definitions, specifically:

Rule 'no-arrow-condition' was removed and replaced by: no-confusing-arrow, no-constant-condition

https://github.com/eslint/eslint/releases/tag/v3.1.0

Update for eslint 2

I'm sure this is on your radar, but eslint 2 has a large number of rule name changes, and these configs don't seem to be up-to-date.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.