xo 0.29.1 → 0.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli-main.js CHANGED
@@ -46,6 +46,7 @@ const cli = meow(`
46
46
  - Add XO to your project with \`npm init xo\`.
47
47
  - Put options in package.json instead of using flags so other tools can read it.
48
48
  `, {
49
+ autoVersion: false,
49
50
  booleanDefault: undefined,
50
51
  flags: {
51
52
  fix: {
@@ -100,15 +101,14 @@ const cli = meow(`
100
101
  type: 'boolean'
101
102
  },
102
103
  stdinFilename: {
103
- type: 'string',
104
- alias: 'filename'
104
+ type: 'string'
105
105
  }
106
106
  }
107
107
  });
108
108
 
109
109
  updateNotifier({pkg: cli.pkg}).notify();
110
110
 
111
- const {input, flags: options} = cli;
111
+ const {input, flags: options, showVersion} = cli;
112
112
 
113
113
  // Make data types for `options.space` match those of the API
114
114
  // Check for string type because `xo --no-space` sets `options.space` to `false`
@@ -141,6 +141,10 @@ if (input[0] === '-') {
141
141
  input.shift();
142
142
  }
143
143
 
144
+ if (options.version) {
145
+ showVersion();
146
+ }
147
+
144
148
  if (options.nodeVersion) {
145
149
  if (options.nodeVersion === 'false') {
146
150
  options.nodeVersion = false;
@@ -154,10 +158,14 @@ if (options.nodeVersion) {
154
158
  if (options.stdin) {
155
159
  const stdin = await getStdin();
156
160
 
161
+ if (options.stdinFilename) {
162
+ options.filename = options.stdinFilename;
163
+ }
164
+
157
165
  if (options.fix) {
158
166
  const result = xo.lintText(stdin, options).results[0];
159
167
  // If there is no output, pass the stdin back out
160
- console.log(result.output || stdin);
168
+ process.stdout.write(result.output || stdin);
161
169
  return;
162
170
  }
163
171
 
package/config/plugins.js CHANGED
@@ -114,12 +114,15 @@ module.exports = {
114
114
  }
115
115
  ],
116
116
 
117
- // TODO: Restore when it becomes safer
117
+ // TODO: Restore when it becomes safer: https://github.com/sindresorhus/eslint-plugin-unicorn/issues/681
118
118
  // 'unicorn/string-content': [
119
119
  // 'error',
120
120
  // {
121
121
  // patterns: {
122
- // [/\.\.\./.source]: ''
122
+ // '': '',
123
+ // [/\.\.\./.source]: '…',
124
+ // '->': '→',
125
+ // [/^http:\/\//.source]: 'http://'
123
126
  // }
124
127
  // }
125
128
  // ],
@@ -132,9 +135,15 @@ module.exports = {
132
135
  }
133
136
  ],
134
137
 
138
+ // TODO: Disabled for now as I don't have time to deal with the backslash that might come from this. Try to enable this rule in 2021.
139
+ 'unicorn/no-null': 'off',
140
+
135
141
  // TODO: Remove this override when the rule is more stable.
136
142
  'unicorn/consistent-function-scoping': 'off',
137
143
 
144
+ // TODO: Temporarily disabled until it becomes more mature.
145
+ 'unicorn/no-useless-undefined': 'off',
146
+
138
147
  // TODO: Temporarily disabled as the rule is buggy.
139
148
  'function-call-argument-newline': 'off',
140
149
 
@@ -156,7 +165,9 @@ module.exports = {
156
165
  {
157
166
  js: 'never',
158
167
  jsx: 'never',
159
- json: 'always'
168
+ json: 'always',
169
+ svg: 'always',
170
+ css: 'always'
160
171
  }
161
172
  ],
162
173
 
@@ -175,6 +186,8 @@ module.exports = {
175
186
  }
176
187
  ],
177
188
  'import/no-absolute-path': 'error',
189
+ 'import/no-anonymous-default-export': 'error',
190
+ 'import/no-named-default': 'error',
178
191
  'import/no-webpack-loader-syntax': 'error',
179
192
  'import/no-self-import': 'error',
180
193
 
@@ -239,6 +252,15 @@ module.exports = {
239
252
  // 'node/no-missing-require': 'error',
240
253
 
241
254
  'node/no-unpublished-bin': 'error',
255
+ 'node/no-mixed-requires': [
256
+ 'error',
257
+ {
258
+ grouping: true,
259
+ allowCall: true
260
+ }
261
+ ],
262
+ 'node/no-new-require': 'error',
263
+ 'node/no-path-concat': 'error',
242
264
 
243
265
  // Disabled because they're too annoying, see:
244
266
  // https://github.com/mysticatea/eslint-plugin-node/issues/105
@@ -345,6 +345,10 @@ const buildExtendsConfig = options => config => {
345
345
  return name;
346
346
  }
347
347
 
348
+ if (name.startsWith('@')) {
349
+ return name;
350
+ }
351
+
348
352
  if (!name.includes('eslint-config-')) {
349
353
  name = `eslint-config-${name}`;
350
354
  }
package/license CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
4
 
5
5
  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:
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xo",
3
- "version": "0.29.1",
3
+ "version": "0.32.1",
4
4
  "description": "JavaScript/TypeScript linter with great defaults",
5
5
  "license": "MIT",
6
6
  "repository": "xojs/xo",
@@ -8,7 +8,7 @@
8
8
  "author": {
9
9
  "name": "Sindre Sorhus",
10
10
  "email": "sindresorhus@gmail.com",
11
- "url": "sindresorhus.com"
11
+ "url": "https://sindresorhus.com"
12
12
  },
13
13
  "bin": "cli.js",
14
14
  "engines": {
@@ -51,67 +51,74 @@
51
51
  "typescript"
52
52
  ],
53
53
  "dependencies": {
54
- "@typescript-eslint/eslint-plugin": "^2.27.0",
55
- "@typescript-eslint/parser": "^2.27.0",
54
+ "@typescript-eslint/eslint-plugin": "^3.1.0",
55
+ "@typescript-eslint/parser": "^3.1.0",
56
56
  "arrify": "^2.0.1",
57
57
  "cosmiconfig": "^6.0.0",
58
- "debug": "^4.1.0",
59
- "eslint": "^6.8.0",
60
- "eslint-config-prettier": "^6.10.0",
61
- "eslint-config-xo": "^0.29.0",
62
- "eslint-config-xo-typescript": "^0.27.0",
58
+ "debug": "^4.1.1",
59
+ "eslint": "^7.1.0",
60
+ "eslint-config-prettier": "^6.11.0",
61
+ "eslint-config-xo": "^0.30.0",
62
+ "eslint-config-xo-typescript": "^0.31.0",
63
63
  "eslint-formatter-pretty": "^3.0.1",
64
64
  "eslint-import-resolver-webpack": "^0.12.1",
65
- "eslint-plugin-ava": "^10.0.1",
66
- "eslint-plugin-eslint-comments": "^3.1.2",
67
- "eslint-plugin-import": "^2.20.1",
68
- "eslint-plugin-no-use-extend-native": "^0.4.1",
69
- "eslint-plugin-node": "^11.0.0",
70
- "eslint-plugin-prettier": "^3.1.2",
65
+ "eslint-plugin-ava": "^10.3.0",
66
+ "eslint-plugin-eslint-comments": "^3.2.0",
67
+ "eslint-plugin-import": "^2.20.2",
68
+ "eslint-plugin-no-use-extend-native": "^0.5.0",
69
+ "eslint-plugin-node": "^11.1.0",
70
+ "eslint-plugin-prettier": "^3.1.3",
71
71
  "eslint-plugin-promise": "^4.2.1",
72
- "eslint-plugin-unicorn": "^18.0.1",
72
+ "eslint-plugin-unicorn": "^20.1.0",
73
73
  "find-cache-dir": "^3.3.1",
74
74
  "find-up": "^4.1.0",
75
75
  "fs-extra": "^9.0.0",
76
- "get-stdin": "^7.0.0",
76
+ "get-stdin": "^8.0.0",
77
77
  "globby": "^9.0.0",
78
78
  "has-flag": "^4.0.0",
79
79
  "imurmurhash": "^0.1.4",
80
80
  "is-path-inside": "^3.0.2",
81
81
  "json-stable-stringify-without-jsonify": "^1.0.1",
82
- "json5": "^2.1.1",
82
+ "json5": "^2.1.3",
83
83
  "lodash": "^4.17.15",
84
- "meow": "^5.0.0",
84
+ "meow": "^7.0.1",
85
85
  "micromatch": "^4.0.2",
86
86
  "open-editor": "^2.0.1",
87
87
  "p-reduce": "^2.1.0",
88
88
  "path-exists": "^4.0.0",
89
- "prettier": "^2.0.4",
89
+ "prettier": "2.0.4",
90
90
  "resolve-cwd": "^3.0.0",
91
91
  "resolve-from": "^5.0.0",
92
- "semver": "^7.2.1",
92
+ "semver": "^7.3.2",
93
93
  "slash": "^3.0.0",
94
94
  "to-absolute-glob": "^2.0.2",
95
- "typescript": "^3.0.0",
96
- "update-notifier": "^4.0.0"
95
+ "typescript": "^3.3.1",
96
+ "update-notifier": "^4.1.0"
97
97
  },
98
98
  "devDependencies": {
99
- "ava": "^1.1.0",
100
- "coveralls": "^3.0.6",
99
+ "ava": "^3.9.0",
100
+ "coveralls": "^3.1.0",
101
101
  "eslint-config-xo-react": "^0.23.0",
102
- "eslint-plugin-react": "^7.19.0",
103
- "eslint-plugin-react-hooks": "^3.0.0",
104
- "execa": "^4.0.0",
105
- "nyc": "^15.0.0",
102
+ "eslint-plugin-react": "^7.20.0",
103
+ "eslint-plugin-react-hooks": "^4.0.4",
104
+ "esm": "^3.2.25",
105
+ "execa": "^4.0.2",
106
+ "nyc": "^15.1.0",
106
107
  "pify": "^5.0.0",
107
108
  "proxyquire": "^2.1.3",
108
109
  "temp-write": "^4.0.0",
109
- "webpack": "^4.42.0"
110
+ "webpack": "^4.43.0"
110
111
  },
111
112
  "eslintConfig": {
112
113
  "extends": "eslint-config-xo"
113
114
  },
114
115
  "eslintIgnore": [
115
116
  "test/fixtures"
116
- ]
117
+ ],
118
+ "ava": {
119
+ "require": [
120
+ "esm"
121
+ ],
122
+ "timeout": "1m"
123
+ }
117
124
  }
package/readme.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  > JavaScript/TypeScript linter with great defaults
10
10
 
11
- [![Build Status](https://travis-ci.org/xojs/xo.svg?branch=master)](https://travis-ci.org/xojs/xo) [![Coverage Status](https://coveralls.io/repos/github/xojs/xo/badge.svg?branch=master)](https://coveralls.io/github/xojs/xo?branch=master) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Gitter](https://badges.gitter.im/join_chat.svg)](https://gitter.im/xojs/Lobby)
11
+ [![Build Status](https://travis-ci.com/xojs/xo.svg?branch=master)](https://travis-ci.com/xojs/xo) [![Coverage Status](https://coveralls.io/repos/github/xojs/xo/badge.svg?branch=master)](https://coveralls.io/github/xojs/xo?branch=master) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Gitter](https://badges.gitter.im/join_chat.svg)](https://gitter.im/xojs/Lobby)
12
12
 
13
13
  Opinionated but configurable ESLint wrapper with lots of goodies included. Enforces strict and readable code. Never discuss code style on a pull request again! No decision-making. No `.eslintrc` or `.jshintrc` to manage. It just works!
14
14