forked from airbnb/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eslint config] [eslint config base] [breaking] Migrate non-React rul…
…es to a separate linter config.
- Loading branch information
Showing
27 changed files
with
199 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./index.js", | ||
"rules": { | ||
// disable requiring trailing commas because it might be nice to revert to | ||
// being JSON at some point, and I don't want to make big changes now. | ||
"comma-dangle": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1.0.0 / 2016-04-16 | ||
================== | ||
- Initial commmit; moved content over from `eslint-config-airbnb` package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# eslint-config-airbnb-base | ||
|
||
[![npm version](https://badge.fury.io/js/eslint-config-airbnb-base.svg)](http://badge.fury.io/js/eslint-config-airbnb-base) | ||
|
||
This package provides Airbnb's base JS .eslintrc as an extensible shared config. | ||
|
||
## Usage | ||
|
||
We export two ESLint configurations for your usage. | ||
|
||
### eslint-config-airbnb-base | ||
|
||
Our default export contains all of our ESLint rules, including ECMAScript 6+ and React. It requires `eslint` and `eslint-plugin-import`. | ||
|
||
1. `npm install --save-dev eslint-config-airbnb-base eslint-plugin-import eslint` | ||
2. add `"extends": "airbnb-base"` to your .eslintrc | ||
|
||
### eslint-config-airbnb-base/legacy | ||
|
||
Lints ES5 and below. Requires `eslint` and `eslint-plugin-import`. | ||
|
||
1. `npm install --save-dev eslint-config-airbnb-base eslint-plugin-import eslint` | ||
2. add `"extends": "airbnb-base/legacy"` to your .eslintrc | ||
|
||
See [Airbnb's overarching ESLint config](https://npmjs.com/eslint-config-airbnb), [Airbnb's Javascript styleguide](https://github.com/airbnb/javascript), and the [ESlint config docs](http://eslint.org/docs/user-guide/configuring#extending-configuration-files) for more information. | ||
|
||
## Improving this config | ||
|
||
Consider adding test cases if you're making complicated rules changes, like anything involving regexes. Perhaps in a distant future, we could use literate programming to structure our README as test cases for our .eslintrc? | ||
|
||
You can run tests with `npm test`. | ||
|
||
You can make sure this module lints with itself using `npm run lint`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
extends: [ | ||
'./legacy', | ||
'./rules/es6', | ||
].map(require.resolve), | ||
parserOptions: { | ||
ecmaVersion: 7, | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
strict: 2, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = { | ||
extends: [ | ||
'./rules/best-practices', | ||
'./rules/errors', | ||
'./rules/legacy', | ||
'./rules/node', | ||
'./rules/style', | ||
'./rules/variables' | ||
].map(require.resolve), | ||
env: { | ||
browser: true, | ||
node: true, | ||
amd: false, | ||
mocha: false, | ||
jasmine: false | ||
}, | ||
ecmaFeatures: {}, | ||
globals: {}, | ||
rules: {} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "eslint-config-airbnb-base", | ||
"version": "1.0.0", | ||
"description": "Airbnb's base JS ESLint config, following our styleguide", | ||
"main": "index.js", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"tests-only": "babel-tape-runner ./test/test-*.js", | ||
"pretest": "eslint-find-rules --unused", | ||
"test": "npm run --silent lint && npm run --silent tests-only" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/airbnb/javascript" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"eslintconfig", | ||
"config", | ||
"airbnb", | ||
"javascript", | ||
"styleguide" | ||
], | ||
"author": "Jake Teton-Landis (https://twitter.com/@jitl)", | ||
"contributors": [ | ||
{ | ||
"name": "Jake Teton-Landis", | ||
"url": "https://twitter.com/jitl" | ||
}, | ||
{ | ||
"name": "Jordan Harband", | ||
"email": "ljharb@gmail.com", | ||
"url": "http://ljharb.codes" | ||
}, | ||
{ | ||
"name": "Harrison Shoff", | ||
"url": "https://twitter.com/hshoff" | ||
} | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/airbnb/javascript/issues" | ||
}, | ||
"homepage": "https://github.com/airbnb/javascript", | ||
"devDependencies": { | ||
"babel-tape-runner": "^1.3.1", | ||
"eslint": "^2.8.0", | ||
"eslint-find-rules": "^1.3.0", | ||
"eslint-plugin-import": "^1.5.0", | ||
"tape": "^4.5.1" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^2.8.0", | ||
"eslint-plugin-import": "^1.5.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"quote-props": 0 | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"rules": { | ||
// disabled because I find it tedious to write tests while following this | ||
// rule | ||
"no-shadow": 0, | ||
// tests uses `t` for tape | ||
"id-length": [2, {"min": 2, "properties": "never", "exceptions": ["t"]}] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import test from 'tape'; | ||
|
||
const index = require('../'); | ||
|
||
const files = { index }; | ||
|
||
fs.readdirSync(path.join(__dirname, '../rules')).forEach(name => { | ||
files[name] = require(`../rules/${name}`); // eslint-disable-line global-require | ||
}); | ||
|
||
Object.keys(files).forEach(name => { | ||
const config = files[name]; | ||
|
||
test(`${name}: does not reference react`, t => { | ||
t.plan(2); | ||
|
||
// scan plugins for react and fail if it is found | ||
const hasReactPlugin = Object.prototype.hasOwnProperty.call(config, 'plugins') && | ||
config.plugins.indexOf('react') !== -1; | ||
t.notOk(hasReactPlugin, 'there is no react plugin'); | ||
|
||
// scan rules for react/ and fail if any exist | ||
const reactRuleIds = Object.keys(config.rules) | ||
.filter(ruleId => ruleId.indexOf('react/') === 0); | ||
t.deepEquals(reactRuleIds, [], 'there are no react/ rules'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
module.exports = { | ||
extends: [ | ||
'./legacy', | ||
'./rules/es6', | ||
].map(require.resolve), | ||
rules: {} | ||
extends: ['eslint-config-airbnb-base'].map(require.resolve), | ||
rules: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,4 @@ | ||
module.exports = { | ||
extends: [ | ||
'./rules/best-practices', | ||
'./rules/errors', | ||
'./rules/legacy', | ||
'./rules/node', | ||
'./rules/style', | ||
'./rules/variables' | ||
].map(require.resolve), | ||
env: { | ||
browser: true, | ||
node: true, | ||
amd: false, | ||
mocha: false, | ||
jasmine: false | ||
}, | ||
ecmaFeatures: {}, | ||
globals: {}, | ||
rules: {} | ||
extends: ['eslint-config-airbnb-base/legacy'].map(require.resolve), | ||
rules: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters