mirror of
https://github.com/airbnb/javascript.git
synced 2026-04-25 03:00:19 -04:00
[eslint config] [*] [new] set ecmaVersion to 2017; enable object rest/spread; update babel-preset-airbnb
This commit is contained in:
@@ -4,5 +4,5 @@
|
||||
// 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
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -9,10 +9,13 @@ module.exports = {
|
||||
'./rules/imports',
|
||||
].map(require.resolve),
|
||||
parserOptions: {
|
||||
ecmaVersion: 2016,
|
||||
ecmaVersion: 2017,
|
||||
sourceType: 'module',
|
||||
ecmaFeatures: {
|
||||
experimentalObjectRestSpread: true,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
strict: 'error',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/airbnb/javascript",
|
||||
"devDependencies": {
|
||||
"babel-preset-airbnb": "^2.0.0",
|
||||
"babel-preset-airbnb": "^2.1.0",
|
||||
"babel-tape-runner": "^2.0.1",
|
||||
"eslint": "^3.6.0",
|
||||
"eslint-find-rules": "^1.13.2",
|
||||
|
||||
@@ -187,6 +187,10 @@ module.exports = {
|
||||
}, {
|
||||
property: '__defineSetter__',
|
||||
message: 'Please use Object.defineProperty instead.',
|
||||
}, {
|
||||
object: 'Object',
|
||||
property: 'assign',
|
||||
message: 'Please use the object spread operator (...) instead.',
|
||||
}],
|
||||
|
||||
// disallow use of assignment in return statement
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"rules": {
|
||||
// disabled because I find it tedious to write tests while following this
|
||||
// rule
|
||||
// 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"]}],
|
||||
|
||||
@@ -4,13 +4,15 @@ import test from 'tape';
|
||||
|
||||
import index from '../';
|
||||
|
||||
const files = { index };
|
||||
const files = { ...{ index } }; // object spread is to test parsing
|
||||
|
||||
fs.readdirSync(path.join(__dirname, '../rules')).forEach((name) => {
|
||||
files[name] = require(`../rules/${name}`); // eslint-disable-line global-require
|
||||
});
|
||||
|
||||
Object.keys(files).forEach((name) => {
|
||||
Object.keys(files).forEach((
|
||||
name, // trailing function comma is to test parsing
|
||||
) => {
|
||||
const config = files[name];
|
||||
|
||||
test(`${name}: does not reference react`, (t) => {
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
"eslint-config-airbnb-base": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-preset-airbnb": "^2.0.0",
|
||||
"babel-preset-airbnb": "^2.1.0",
|
||||
"babel-tape-runner": "^2.0.1",
|
||||
"eslint": "^3.6.0",
|
||||
"eslint-find-rules": "^1.13.2",
|
||||
|
||||
Reference in New Issue
Block a user