Skip to content

Commit e80c094

Browse files
committed
Remove the esnext option
1 parent b385bee commit e80c094

File tree

19 files changed

+44
-93
lines changed

19 files changed

+44
-93
lines changed

cli-main.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const cli = meow(`
2727
--open Open files with issues in your editor
2828
--quiet Show only errors and no warnings
2929
--extension Additional extension to lint [Can be set multiple times]
30-
--no-esnext Don't enforce ES2015+ rules
3130
--cwd=<dir> Working directory for files
3231
--stdin Validate/fix code from stdin
3332
--stdin-filename Specify a filename for the --stdin option
@@ -97,9 +96,6 @@ const cli = meow(`
9796
type: 'string',
9897
isMultiple: true
9998
},
100-
esnext: {
101-
type: 'boolean'
102-
},
10399
cwd: {
104100
type: 'string'
105101
},

lib/options-manager.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@ const mergeWithFileConfigs = async (files, options, configFiles) => {
162162
([tsConfigPath, groups]) => {
163163
const files = [].concat(...groups.map(group => group.files));
164164
const cachePath = getTsConfigCachePath(files, tsConfigPath);
165-
groups.forEach(group => {
165+
166+
for (const group of groups) {
166167
group.options.tsConfigPath = cachePath;
167-
});
168+
}
169+
168170
return outputJson(cachePath, makeTSConfig(tsConfigs[tsConfigPath], tsConfigPath, files));
169171
}
170172
));
@@ -180,11 +182,11 @@ Hashing based on https://github.com/eslint/eslint/blob/cf38d0d939b62f3670cdd59f0
180182
*/
181183
const getTsConfigCachePath = (files, tsConfigPath) => path.join(
182184
cacheLocation,
183-
`tsconfig.${murmur(`${pkg.version}_${nodeVersion}_${stringify({files: files.sort(), tsConfigPath: tsConfigPath})}`).result().toString(36)}.json`
185+
`tsconfig.${murmur(`${pkg.version}_${nodeVersion}_${stringify({files: files.sort(), tsConfigPath})}`).result().toString(36)}.json`
184186
);
185187

186188
const makeTSConfig = (tsConfig, tsConfigPath, files) => {
187-
const config = {files: files.filter(isTypescript)};
189+
const config = {files: files.filter(file => isTypescript(file))};
188190

189191
if (tsConfig) {
190192
config.extends = tsConfigPath;
@@ -308,13 +310,6 @@ const buildXOConfig = options => config => {
308310
}];
309311
}
310312

311-
if (options.esnext !== false) {
312-
config.baseConfig.extends = [
313-
'xo/esnext',
314-
path.join(__dirname, '../config/plugins.js')
315-
];
316-
}
317-
318313
if (options.ts) {
319314
config.rules['unicorn/import-style'] = 'off';
320315
config.rules['node/file-extension-in-import'] = 'off';
@@ -464,7 +459,7 @@ const applyOverrides = (file, options) => {
464459
const {overrides} = options;
465460
delete options.overrides;
466461

467-
let {applicable, hash} = findApplicableOverrides(path.relative(options.cwd, file), overrides);
462+
const {applicable, hash} = findApplicableOverrides(path.relative(options.cwd, file), overrides);
468463

469464
options = mergeWith(...[getEmptyOptions(), options].concat(applicable.map(override => normalizeOptions(override)), mergeFn));
470465
delete options.files;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"debug": "^4.3.1",
5959
"eslint": "^7.20.0",
6060
"eslint-config-prettier": "^7.2.0",
61-
"eslint-config-xo": "^0.35.0",
61+
"eslint-config-xo": "^0.36.0",
6262
"eslint-config-xo-typescript": "^0.38.0",
6363
"eslint-formatter-pretty": "^4.0.0",
6464
"eslint-import-resolver-webpack": "^0.13.0",

readme.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ $ xo --help
6868
--open Open files with issues in your editor
6969
--quiet Show only errors and no warnings
7070
--extension Additional extension to lint [Can be set multiple times]
71-
--no-esnext Don't enforce ES2015+ rules
7271
--cwd=<dir> Working directory for files
7372
--stdin Validate/fix code from stdin
7473
--stdin-filename Specify a filename for the --stdin option
@@ -267,15 +266,6 @@ Type: `string`
267266

268267
[ESLint processor.](https://eslint.org/docs/user-guide/configuring#specifying-processor)
269268

270-
### esnext
271-
272-
Type: `boolean`\
273-
Default: `true`
274-
275-
Enforce ES2015+ rules. Disabling this will make it not *enforce* ES2015+ syntax and conventions.
276-
277-
*ES2015+ is parsed even without this option. You can already use ES2017 features like [`async`/`await`](https://github.com/lukehoban/ecmascript-asyncawait).
278-
279269
### webpack
280270

281271
Type: `boolean | object`
@@ -317,12 +307,11 @@ XO makes it easy to override configs for specific files. The `overrides` propert
317307
"overrides": [
318308
{
319309
"files": "test/*.js",
320-
"esnext": false,
321310
"space": 3
322311
},
323312
{
324313
"files": "test/foo.js",
325-
"esnext": true
314+
"semicolon": true
326315
}
327316
]
328317
}
@@ -331,11 +320,10 @@ XO makes it easy to override configs for specific files. The `overrides` propert
331320

332321
- The base configuration is simply `space: 2`, `semicolon: false`. These settings are used for every file unless otherwise noted below.
333322

334-
- For every file in `test/*.js`, the base config is used, but `space` is overridden with `3`, and the `esnext` option is set to `false`. The resulting config is:
323+
- For every file in `test/*.js`, the base config is used, but `space` is overridden with `3`. The resulting config is:
335324

336325
```json
337326
{
338-
"esnext": false,
339327
"semicolon": false,
340328
"space": 3
341329
}
@@ -345,8 +333,7 @@ XO makes it easy to override configs for specific files. The `overrides` propert
345333

346334
```json
347335
{
348-
"esnext": true,
349-
"semicolon": false,
336+
"semicolon": true,
350337
"space": 3
351338
}
352339
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"esnext": true
2+
"space": true
33
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
var obj = { a: 1 };
2-
console.log(obj.a);
1+
const object = {
2+
a: 1
3+
};
4+
5+
console.log(object.a);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
esnext: true
3-
}
2+
space: true
3+
};
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
var obj = { a: 1 };
2-
console.log(obj.a);
1+
const object = {
2+
a: 1
3+
};
4+
5+
console.log(object.a);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"esnext": true
2+
"space": true
33
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
var obj = { a: 1 };
2-
console.log(obj.a);
1+
const object = {
2+
a: 1
3+
};
4+
5+
console.log(object.a);

0 commit comments

Comments
 (0)