Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Commit

Permalink
New: Create eslint-config-eslint (fixes eslint#3525)
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas authored and lizardruss committed Oct 29, 2015
1 parent 94c3543 commit 325c5f2
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 95 deletions.
96 changes: 1 addition & 95 deletions .eslintrc
Expand Up @@ -4,98 +4,4 @@ env:
node: true

extends:
"eslint:recommended"

rules:
indent: [2, 4, {SwitchCase: 1}]
block-spacing: 2
brace-style: [2, "1tbs"]
camelcase: [2, { properties: "never" }]
callback-return: [2, ["cb", "callback", "next"]]
comma-spacing: 2
comma-style: [2, "last"]
consistent-return: 2
curly: [2, "all"]
default-case: 2
dot-notation: [2, { allowKeywords: true }]
eol-last: 2
eqeqeq: 2
func-style: [2, "declaration"]
guard-for-in: 2
key-spacing: [2, { beforeColon: false, afterColon: true }]
new-cap: 2
new-parens: 2
no-alert: 2
no-array-constructor: 2
no-caller: 2
no-console: 0
no-delete-var: 2
no-empty-label: 2
no-eval: 2
no-extend-native: 2
no-extra-bind: 2
no-fallthrough: 2
no-floating-decimal: 2
no-implied-eval: 2
no-invalid-this: 2
no-iterator: 2
no-label-var: 2
no-labels: 2
no-lone-blocks: 2
no-loop-func: 2
no-mixed-spaces-and-tabs: [2, false]
no-multi-spaces: 2
no-multi-str: 2
no-native-reassign: 2
no-nested-ternary: 2
no-new: 2
no-new-func: 2
no-new-object: 2
no-new-wrappers: 2
no-octal: 2
no-octal-escape: 2
no-process-exit: 2
no-proto: 2
no-redeclare: 2
no-return-assign: 2
no-script-url: 2
no-sequences: 2
no-shadow: 2
no-shadow-restricted-names: 2
no-spaced-func: 2
no-trailing-spaces: 2
no-undef: 2
no-undef-init: 2
no-undefined: 2
no-underscore-dangle: 2
no-unused-expressions: 2
no-unused-vars: [2, {vars: "all", args: "after-used"}]
no-use-before-define: 2
no-useless-concat: 2
no-with: 2
quotes: [2, "double"]
radix: 2
require-jsdoc: 2
semi: 2
semi-spacing: [2, {before: false, after: true}]
space-after-keywords: [2, "always"]
space-before-blocks: 2
space-before-function-paren: [2, "never"]
space-infix-ops: 2
space-return-throw-case: 2
space-unary-ops: [2, {words: true, nonwords: false}]
spaced-comment: [2, "always", { exceptions: ["-"]}]
strict: [2, "global"]
valid-jsdoc: [2, { prefer: { "return": "returns"}}]
wrap-iife: 2
yoda: [2, "never"]

# Previously on by default in node environment
no-catch-shadow: 0
no-console: 0
no-mixed-requires: 2
no-new-require: 2
no-path-concat: 2
no-process-exit: 2
global-strict: [0, "always"]
handle-callback-err: [2, "err"]
"./packages/eslint-config-eslint/default.yml"
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -11,3 +11,4 @@ versions.json
*.iml
.eslintcache
.cache
**/node_modules
20 changes: 20 additions & 0 deletions packages/eslint-config-eslint/LICENSE
@@ -0,0 +1,20 @@
ESLint
Copyright (c) 2013 Nicholas C. Zakas. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
34 changes: 34 additions & 0 deletions packages/eslint-config-eslint/README.md
@@ -0,0 +1,34 @@
[![NPM version][npm-image]][npm-url]
[![Join the chat at https://gitter.im/eslint/eslint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

# ESLint Configuration

[Website](http://eslint.org) | [Configuring](http://eslint.org/docs/user-guide/configuring) | [Rules](http://eslint.org/docs/rules/) | [Contributing](http://eslint.org/docs/developer-guide/contributing) | [Twitter](https://twitter.com/geteslint) | [Mailing List](https://groups.google.com/group/eslint)

Contains the default ESLint configuration for ESLint projects.

## Installation

You can install ESLint using npm:

npm install eslint --save-dev

Then install this configuration:

npm install eslint-config-eslint --save-dev

## Usage

In your `.eslintrc` file, add:

```json
{
"extends": "eslint"
}
```

### Where to ask for help?

Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://gitter.im/eslint/eslint)

[npm-image]: https://img.shields.io/npm/v/eslint.svg?style=flat-square
96 changes: 96 additions & 0 deletions packages/eslint-config-eslint/default.yml
@@ -0,0 +1,96 @@
extends:
"eslint:recommended"

rules:
indent: [2, 4, {SwitchCase: 1}]
block-spacing: 2
brace-style: [2, "1tbs"]
camelcase: [2, { properties: "never" }]
callback-return: [2, ["cb", "callback", "next"]]
comma-spacing: 2
comma-style: [2, "last"]
consistent-return: 2
curly: [2, "all"]
default-case: 2
dot-notation: [2, { allowKeywords: true }]
eol-last: 2
eqeqeq: 2
func-style: [2, "declaration"]
guard-for-in: 2
key-spacing: [2, { beforeColon: false, afterColon: true }]
new-cap: 2
new-parens: 2
no-alert: 2
no-array-constructor: 2
no-caller: 2
no-console: 0
no-delete-var: 2
no-empty-label: 2
no-eval: 2
no-extend-native: 2
no-extra-bind: 2
no-fallthrough: 2
no-floating-decimal: 2
no-implied-eval: 2
no-invalid-this: 2
no-iterator: 2
no-label-var: 2
no-labels: 2
no-lone-blocks: 2
no-loop-func: 2
no-mixed-spaces-and-tabs: [2, false]
no-multi-spaces: 2
no-multi-str: 2
no-native-reassign: 2
no-nested-ternary: 2
no-new: 2
no-new-func: 2
no-new-object: 2
no-new-wrappers: 2
no-octal: 2
no-octal-escape: 2
no-process-exit: 2
no-proto: 2
no-redeclare: 2
no-return-assign: 2
no-script-url: 2
no-sequences: 2
no-shadow: 2
no-shadow-restricted-names: 2
no-spaced-func: 2
no-trailing-spaces: 2
no-undef: 2
no-undef-init: 2
no-undefined: 2
no-underscore-dangle: 2
no-unused-expressions: 2
no-unused-vars: [2, {vars: "all", args: "after-used"}]
no-use-before-define: 2
no-useless-concat: 2
no-with: 2
quotes: [2, "double"]
radix: 2
require-jsdoc: 2
semi: 2
semi-spacing: [2, {before: false, after: true}]
space-after-keywords: [2, "always"]
space-before-blocks: 2
space-before-function-paren: [2, "never"]
space-infix-ops: 2
space-return-throw-case: 2
space-unary-ops: [2, {words: true, nonwords: false}]
spaced-comment: [2, "always", { exceptions: ["-"]}]
strict: [2, "global"]
valid-jsdoc: [2, { prefer: { "return": "returns"}}]
wrap-iife: 2
yoda: [2, "never"]

# Previously on by default in node environment
no-catch-shadow: 0
no-console: 0
no-mixed-requires: 2
no-new-require: 2
no-path-concat: 2
no-process-exit: 2
global-strict: [0, "always"]
handle-callback-err: [2, "err"]
32 changes: 32 additions & 0 deletions packages/eslint-config-eslint/index.js
@@ -0,0 +1,32 @@
/**
* @fileoverview Converts YAML file into JSON.
* @author Nicholas C. Zakas
* @copyright 2015 Nicholas C. Zakas. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

var fs = require("fs"),
yaml = require("js-yaml");

//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------

module.exports = (function() {

var filePath = "./default.yml";

try {
return yaml.safeLoad(fs.readFileSync(filePath, "utf8")) || {};
} catch (e) {
console.error("Error reading YAML file: " + filePath);
e.message = "Cannot read config file: " + filePath + "\nError: " + e.message;
throw e;
}

}());
34 changes: 34 additions & 0 deletions packages/eslint-config-eslint/package.json
@@ -0,0 +1,34 @@
{
"name": "eslint-config-eslint",
"version": "1.0.0",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
"description": "Default ESLint configuration for ESLint projects.",
"scripts": {
"test": "node ./index.js",
"prepublish": "npm test"
},
"files": [
"LICENSE",
"README.md",
"index.js",
"default.yml"
],
"repository": {
"type": "git",
"url": "https://github.com/eslint/eslint"
},
"homepage": "http://eslint.org",
"bugs": "https://github.com/eslint/eslint/issues/",
"dependencies": {
"js-yaml": "^3.4.3"
},
"keywords": [
"eslintconfig",
"eslint-config",
"eslint"
],
"license": "MIT",
"engines": {
"node": ">=0.10"
}
}

0 comments on commit 325c5f2

Please sign in to comment.