Skip to content

Commit 0a752c7

Browse files
authored
Update dependencies (#568)
1 parent 41c8f39 commit 0a752c7

15 files changed

+274
-277
lines changed

cli.js

+21-20
Original file line numberDiff line numberDiff line change
@@ -45,70 +45,71 @@ const cli = meow(`
4545
- Add XO to your project with \`npm init xo\`.
4646
- Put options in package.json instead of using flags so other tools can read it.
4747
`, {
48+
importMeta: import.meta,
4849
autoVersion: false,
4950
booleanDefault: undefined,
5051
flags: {
5152
fix: {
52-
type: 'boolean'
53+
type: 'boolean',
5354
},
5455
reporter: {
55-
type: 'string'
56+
type: 'string',
5657
},
5758
env: {
5859
type: 'string',
59-
isMultiple: true
60+
isMultiple: true,
6061
},
6162
global: {
6263
type: 'string',
63-
isMultiple: true
64+
isMultiple: true,
6465
},
6566
ignore: {
6667
type: 'string',
67-
isMultiple: true
68+
isMultiple: true,
6869
},
6970
space: {
70-
type: 'string'
71+
type: 'string',
7172
},
7273
semicolon: {
73-
type: 'boolean'
74+
type: 'boolean',
7475
},
7576
prettier: {
76-
type: 'boolean'
77+
type: 'boolean',
7778
},
7879
nodeVersion: {
79-
type: 'string'
80+
type: 'string',
8081
},
8182
plugin: {
8283
type: 'string',
83-
isMultiple: true
84+
isMultiple: true,
8485
},
8586
extend: {
8687
type: 'string',
87-
isMultiple: true
88+
isMultiple: true,
8889
},
8990
open: {
90-
type: 'boolean'
91+
type: 'boolean',
9192
},
9293
quiet: {
93-
type: 'boolean'
94+
type: 'boolean',
9495
},
9596
extension: {
9697
type: 'string',
97-
isMultiple: true
98+
isMultiple: true,
9899
},
99100
cwd: {
100-
type: 'string'
101+
type: 'string',
101102
},
102103
printConfig: {
103-
type: 'string'
104+
type: 'string',
104105
},
105106
stdin: {
106-
type: 'boolean'
107+
type: 'boolean',
107108
},
108109
stdinFilename: {
109-
type: 'string'
110-
}
111-
}
110+
type: 'string',
111+
},
112+
},
112113
});
113114

114115
const {input, flags: options, showVersion} = cli;

index.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ import {
1616
mergeWithFileConfig,
1717
mergeWithFileConfigs,
1818
buildConfig,
19-
mergeOptions
19+
mergeOptions,
2020
} from './lib/options-manager.js';
2121

2222
/** Merge multiple reports into a single report */
2323
const mergeReports = reports => {
2424
const report = {
2525
results: [],
2626
errorCount: 0,
27-
warningCount: 0
27+
warningCount: 0,
2828
};
2929

3030
for (const currentReport of reports) {
@@ -41,7 +41,7 @@ const getReportStatistics = results => {
4141
errorCount: 0,
4242
warningCount: 0,
4343
fixableErrorCount: 0,
44-
fixableWarningCount: 0
44+
fixableWarningCount: 0,
4545
};
4646

4747
for (const result of results) {
@@ -61,7 +61,7 @@ const processReport = (report, {isQuiet = false} = {}) => {
6161

6262
const result = {
6363
results: report,
64-
...getReportStatistics(report)
64+
...getReportStatistics(report),
6565
};
6666

6767
defineLazyProperty(result, 'usedDeprecatedRules', () => {
@@ -95,7 +95,7 @@ const runEslint = async (paths, options, processorOptions) => {
9595
const globFiles = async (patterns, {ignores, extensions, cwd}) => (
9696
await globby(
9797
patterns.length === 0 ? [`**/*.{${extensions.join(',')}}`] : arrify(patterns),
98-
{ignore: ignores, gitignore: true, cwd}
98+
{ignore: ignores, gitignore: true, cwd},
9999
)).filter(file => extensions.includes(path.extname(file).slice(1))).map(file => path.resolve(cwd, file));
100100

101101
const getConfig = async options => {
@@ -120,9 +120,9 @@ const lintText = async (string, inputOptions = {}) => {
120120
const filename = path.relative(options.cwd, filePath);
121121

122122
if (
123-
micromatch.isMatch(filename, options.baseConfig.ignorePatterns) ||
124-
globby.gitignore.sync({cwd: options.cwd, ignore: options.baseConfig.ignorePatterns})(filePath) ||
125-
await engine.isPathIgnored(filePath)
123+
micromatch.isMatch(filename, options.baseConfig.ignorePatterns)
124+
|| globby.gitignore.sync({cwd: options.cwd, ignore: options.baseConfig.ignorePatterns})(filePath)
125+
|| await engine.isPathIgnored(filePath)
126126
) {
127127
return {
128128
errorCount: 0,
@@ -131,8 +131,8 @@ const lintText = async (string, inputOptions = {}) => {
131131
errorCount: 0,
132132
filePath: filename,
133133
messages: [],
134-
warningCount: 0
135-
}]
134+
warningCount: 0,
135+
}],
136136
};
137137
}
138138
}
@@ -149,17 +149,17 @@ const lintFiles = async (patterns, inputOptions = {}) => {
149149
const configFiles = (await Promise.all(
150150
(await globby(
151151
CONFIG_FILES.map(configFile => `**/${configFile}`),
152-
{ignore: DEFAULT_IGNORES, gitignore: true, cwd: inputOptions.cwd}
153-
)).map(async configFile => configExplorer.load(path.resolve(inputOptions.cwd, configFile)))
152+
{ignore: DEFAULT_IGNORES, gitignore: true, cwd: inputOptions.cwd},
153+
)).map(async configFile => configExplorer.load(path.resolve(inputOptions.cwd, configFile))),
154154
)).filter(Boolean);
155155

156-
const paths = configFiles.length > 0 ?
157-
await pReduce(
156+
const paths = configFiles.length > 0
157+
? await pReduce(
158158
configFiles,
159159
async (paths, {filepath, config}) =>
160160
[...paths, ...(await globFiles(patterns, {...mergeOptions(inputOptions, config), cwd: path.dirname(filepath)}))],
161-
[]) :
162-
await globFiles(patterns, mergeOptions(inputOptions));
161+
[])
162+
: await globFiles(patterns, mergeOptions(inputOptions));
163163

164164
return mergeReports(await pMap(await mergeWithFileConfigs([...new Set(paths)], inputOptions, configFiles), async ({files, options, prettierOptions}) => runEslint(files, buildConfig(options, prettierOptions), {isQuiet: options.quiet})));
165165
};
@@ -175,5 +175,5 @@ export default {
175175
outputFixes: async ({results}) => ESLint.outputFixes(results),
176176
getConfig,
177177
lintText,
178-
lintFiles
178+
lintFiles,
179179
};

lib/constants.js

+25-25
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const DEFAULT_IGNORES = [
77
'**/*.min.js',
88
'vendor/**',
99
'dist/**',
10-
'tap-snapshots/*.{cjs,js}'
10+
'tap-snapshots/*.{cjs,js}',
1111
];
1212

1313
/**
@@ -18,20 +18,20 @@ const MERGE_OPTIONS_CONCAT = [
1818
'extends',
1919
'envs',
2020
'globals',
21-
'plugins'
21+
'plugins',
2222
];
2323

2424
const TYPESCRIPT_EXTENSION = [
2525
'ts',
26-
'tsx'
26+
'tsx',
2727
];
2828

2929
const DEFAULT_EXTENSION = [
3030
'js',
3131
'jsx',
3232
'mjs',
3333
'cjs',
34-
...TYPESCRIPT_EXTENSION
34+
...TYPESCRIPT_EXTENSION,
3535
];
3636

3737
/**
@@ -60,57 +60,57 @@ With `engines.node` set to `>=8` the rule `plugin/rule` will be used with the co
6060
*/
6161
const ENGINE_RULES = {
6262
'unicorn/prefer-spread': {
63-
'5.0.0': 'off'
63+
'5.0.0': 'off',
6464
},
6565
'unicorn/no-new-buffer': {
66-
'5.10.0': 'off'
66+
'5.10.0': 'off',
6767
},
6868
'prefer-rest-params': {
69-
'6.0.0': 'off'
69+
'6.0.0': 'off',
7070
},
7171
'prefer-destructuring': {
72-
'6.0.0': 'off'
72+
'6.0.0': 'off',
7373
},
7474
'promise/prefer-await-to-then': {
75-
'7.6.0': 'off'
75+
'7.6.0': 'off',
7676
},
7777
'prefer-object-spread': {
78-
'8.3.0': 'off'
78+
'8.3.0': 'off',
7979
},
8080
'node/prefer-global/url-search-params': {
81-
'10.0.0': 'off'
81+
'10.0.0': 'off',
8282
},
8383
'node/prefer-global/url': {
84-
'10.0.0': 'off'
84+
'10.0.0': 'off',
8585
},
8686
'no-useless-catch': {
87-
'10.0.0': 'off'
87+
'10.0.0': 'off',
8888
},
8989
'prefer-named-capture-group': {
90-
'10.0.0': 'off'
90+
'10.0.0': 'off',
9191
},
9292
'node/prefer-global/text-encoder': {
93-
'11.0.0': 'off'
93+
'11.0.0': 'off',
9494
},
9595
'node/prefer-global/text-decoder': {
96-
'11.0.0': 'off'
96+
'11.0.0': 'off',
9797
},
9898
'unicorn/prefer-flat-map': {
99-
'11.0.0': 'off'
99+
'11.0.0': 'off',
100100
},
101101
'node/prefer-promises/dns': {
102-
'11.14.0': 'off'
102+
'11.14.0': 'off',
103103
},
104104
'node/prefer-promises/fs': {
105-
'11.14.0': 'off'
106-
}
105+
'11.14.0': 'off',
106+
},
107107
};
108108

109109
const PRETTIER_CONFIG_OVERRIDE = {
110110
'eslint-plugin-babel': 'prettier/babel',
111111
'eslint-plugin-flowtype': 'prettier/flowtype',
112112
'eslint-plugin-standard': 'prettier/standard',
113-
'eslint-plugin-vue': 'prettier/vue'
113+
'eslint-plugin-vue': 'prettier/vue',
114114
};
115115

116116
const MODULE_NAME = 'xo';
@@ -122,7 +122,7 @@ const CONFIG_FILES = [
122122
`.${MODULE_NAME}-config.js`,
123123
`.${MODULE_NAME}-config.cjs`,
124124
`${MODULE_NAME}.config.js`,
125-
`${MODULE_NAME}.config.cjs`
125+
`${MODULE_NAME}.config.cjs`,
126126
];
127127

128128
const TSCONFIG_DEFAULTS = {
@@ -133,8 +133,8 @@ const TSCONFIG_DEFAULTS = {
133133
noImplicitReturns: true,
134134
noUnusedLocals: true,
135135
noUnusedParameters: true,
136-
noFallthroughCasesInSwitch: true
137-
}
136+
noFallthroughCasesInSwitch: true,
137+
},
138138
};
139139

140140
const CACHE_DIR_NAME = 'xo-linter';
@@ -149,5 +149,5 @@ export {
149149
CONFIG_FILES,
150150
MERGE_OPTIONS_CONCAT,
151151
TSCONFIG_DEFAULTS,
152-
CACHE_DIR_NAME
152+
CACHE_DIR_NAME,
153153
};

lib/open-report.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
import openEditor from 'open-editor';
23

34
const sortResults = (a, b) => a.errorCount + b.errorCount > 0 ? (a.errorCount - b.errorCount) : (a.warningCount - b.warningCount);
@@ -27,7 +28,7 @@ const resultToFile = result => {
2728
return {
2829
file: result.filePath,
2930
line: message.line,
30-
column: message.column
31+
column: message.column,
3132
};
3233
};
3334

0 commit comments

Comments
 (0)