diff --git a/cli.js b/cli.js index 6fa2f447..cac9446f 100755 --- a/cli.js +++ b/cli.js @@ -45,70 +45,71 @@ const cli = meow(` - Add XO to your project with \`npm init xo\`. - Put options in package.json instead of using flags so other tools can read it. `, { + importMeta: import.meta, autoVersion: false, booleanDefault: undefined, flags: { fix: { - type: 'boolean' + type: 'boolean', }, reporter: { - type: 'string' + type: 'string', }, env: { type: 'string', - isMultiple: true + isMultiple: true, }, global: { type: 'string', - isMultiple: true + isMultiple: true, }, ignore: { type: 'string', - isMultiple: true + isMultiple: true, }, space: { - type: 'string' + type: 'string', }, semicolon: { - type: 'boolean' + type: 'boolean', }, prettier: { - type: 'boolean' + type: 'boolean', }, nodeVersion: { - type: 'string' + type: 'string', }, plugin: { type: 'string', - isMultiple: true + isMultiple: true, }, extend: { type: 'string', - isMultiple: true + isMultiple: true, }, open: { - type: 'boolean' + type: 'boolean', }, quiet: { - type: 'boolean' + type: 'boolean', }, extension: { type: 'string', - isMultiple: true + isMultiple: true, }, cwd: { - type: 'string' + type: 'string', }, printConfig: { - type: 'string' + type: 'string', }, stdin: { - type: 'boolean' + type: 'boolean', }, stdinFilename: { - type: 'string' - } - } + type: 'string', + }, + }, }); const {input, flags: options, showVersion} = cli; diff --git a/index.js b/index.js index 9325cfde..ce203bf3 100644 --- a/index.js +++ b/index.js @@ -16,7 +16,7 @@ import { mergeWithFileConfig, mergeWithFileConfigs, buildConfig, - mergeOptions + mergeOptions, } from './lib/options-manager.js'; /** Merge multiple reports into a single report */ @@ -24,7 +24,7 @@ const mergeReports = reports => { const report = { results: [], errorCount: 0, - warningCount: 0 + warningCount: 0, }; for (const currentReport of reports) { @@ -41,7 +41,7 @@ const getReportStatistics = results => { errorCount: 0, warningCount: 0, fixableErrorCount: 0, - fixableWarningCount: 0 + fixableWarningCount: 0, }; for (const result of results) { @@ -61,7 +61,7 @@ const processReport = (report, {isQuiet = false} = {}) => { const result = { results: report, - ...getReportStatistics(report) + ...getReportStatistics(report), }; defineLazyProperty(result, 'usedDeprecatedRules', () => { @@ -95,7 +95,7 @@ const runEslint = async (paths, options, processorOptions) => { const globFiles = async (patterns, {ignores, extensions, cwd}) => ( await globby( patterns.length === 0 ? [`**/*.{${extensions.join(',')}}`] : arrify(patterns), - {ignore: ignores, gitignore: true, cwd} + {ignore: ignores, gitignore: true, cwd}, )).filter(file => extensions.includes(path.extname(file).slice(1))).map(file => path.resolve(cwd, file)); const getConfig = async options => { @@ -120,9 +120,9 @@ const lintText = async (string, inputOptions = {}) => { const filename = path.relative(options.cwd, filePath); if ( - micromatch.isMatch(filename, options.baseConfig.ignorePatterns) || - globby.gitignore.sync({cwd: options.cwd, ignore: options.baseConfig.ignorePatterns})(filePath) || - await engine.isPathIgnored(filePath) + micromatch.isMatch(filename, options.baseConfig.ignorePatterns) + || globby.gitignore.sync({cwd: options.cwd, ignore: options.baseConfig.ignorePatterns})(filePath) + || await engine.isPathIgnored(filePath) ) { return { errorCount: 0, @@ -131,8 +131,8 @@ const lintText = async (string, inputOptions = {}) => { errorCount: 0, filePath: filename, messages: [], - warningCount: 0 - }] + warningCount: 0, + }], }; } } @@ -149,17 +149,17 @@ const lintFiles = async (patterns, inputOptions = {}) => { const configFiles = (await Promise.all( (await globby( CONFIG_FILES.map(configFile => `**/${configFile}`), - {ignore: DEFAULT_IGNORES, gitignore: true, cwd: inputOptions.cwd} - )).map(async configFile => configExplorer.load(path.resolve(inputOptions.cwd, configFile))) + {ignore: DEFAULT_IGNORES, gitignore: true, cwd: inputOptions.cwd}, + )).map(async configFile => configExplorer.load(path.resolve(inputOptions.cwd, configFile))), )).filter(Boolean); - const paths = configFiles.length > 0 ? - await pReduce( + const paths = configFiles.length > 0 + ? await pReduce( configFiles, async (paths, {filepath, config}) => [...paths, ...(await globFiles(patterns, {...mergeOptions(inputOptions, config), cwd: path.dirname(filepath)}))], - []) : - await globFiles(patterns, mergeOptions(inputOptions)); + []) + : await globFiles(patterns, mergeOptions(inputOptions)); return mergeReports(await pMap(await mergeWithFileConfigs([...new Set(paths)], inputOptions, configFiles), async ({files, options, prettierOptions}) => runEslint(files, buildConfig(options, prettierOptions), {isQuiet: options.quiet}))); }; @@ -175,5 +175,5 @@ export default { outputFixes: async ({results}) => ESLint.outputFixes(results), getConfig, lintText, - lintFiles + lintFiles, }; diff --git a/lib/constants.js b/lib/constants.js index a4f8a2b3..d0a7dd5a 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -7,7 +7,7 @@ const DEFAULT_IGNORES = [ '**/*.min.js', 'vendor/**', 'dist/**', - 'tap-snapshots/*.{cjs,js}' + 'tap-snapshots/*.{cjs,js}', ]; /** @@ -18,12 +18,12 @@ const MERGE_OPTIONS_CONCAT = [ 'extends', 'envs', 'globals', - 'plugins' + 'plugins', ]; const TYPESCRIPT_EXTENSION = [ 'ts', - 'tsx' + 'tsx', ]; const DEFAULT_EXTENSION = [ @@ -31,7 +31,7 @@ const DEFAULT_EXTENSION = [ 'jsx', 'mjs', 'cjs', - ...TYPESCRIPT_EXTENSION + ...TYPESCRIPT_EXTENSION, ]; /** @@ -60,57 +60,57 @@ With `engines.node` set to `>=8` the rule `plugin/rule` will be used with the co */ const ENGINE_RULES = { 'unicorn/prefer-spread': { - '5.0.0': 'off' + '5.0.0': 'off', }, 'unicorn/no-new-buffer': { - '5.10.0': 'off' + '5.10.0': 'off', }, 'prefer-rest-params': { - '6.0.0': 'off' + '6.0.0': 'off', }, 'prefer-destructuring': { - '6.0.0': 'off' + '6.0.0': 'off', }, 'promise/prefer-await-to-then': { - '7.6.0': 'off' + '7.6.0': 'off', }, 'prefer-object-spread': { - '8.3.0': 'off' + '8.3.0': 'off', }, 'node/prefer-global/url-search-params': { - '10.0.0': 'off' + '10.0.0': 'off', }, 'node/prefer-global/url': { - '10.0.0': 'off' + '10.0.0': 'off', }, 'no-useless-catch': { - '10.0.0': 'off' + '10.0.0': 'off', }, 'prefer-named-capture-group': { - '10.0.0': 'off' + '10.0.0': 'off', }, 'node/prefer-global/text-encoder': { - '11.0.0': 'off' + '11.0.0': 'off', }, 'node/prefer-global/text-decoder': { - '11.0.0': 'off' + '11.0.0': 'off', }, 'unicorn/prefer-flat-map': { - '11.0.0': 'off' + '11.0.0': 'off', }, 'node/prefer-promises/dns': { - '11.14.0': 'off' + '11.14.0': 'off', }, 'node/prefer-promises/fs': { - '11.14.0': 'off' - } + '11.14.0': 'off', + }, }; const PRETTIER_CONFIG_OVERRIDE = { 'eslint-plugin-babel': 'prettier/babel', 'eslint-plugin-flowtype': 'prettier/flowtype', 'eslint-plugin-standard': 'prettier/standard', - 'eslint-plugin-vue': 'prettier/vue' + 'eslint-plugin-vue': 'prettier/vue', }; const MODULE_NAME = 'xo'; @@ -122,7 +122,7 @@ const CONFIG_FILES = [ `.${MODULE_NAME}-config.js`, `.${MODULE_NAME}-config.cjs`, `${MODULE_NAME}.config.js`, - `${MODULE_NAME}.config.cjs` + `${MODULE_NAME}.config.cjs`, ]; const TSCONFIG_DEFAULTS = { @@ -133,8 +133,8 @@ const TSCONFIG_DEFAULTS = { noImplicitReturns: true, noUnusedLocals: true, noUnusedParameters: true, - noFallthroughCasesInSwitch: true - } + noFallthroughCasesInSwitch: true, + }, }; const CACHE_DIR_NAME = 'xo-linter'; @@ -149,5 +149,5 @@ export { CONFIG_FILES, MERGE_OPTIONS_CONCAT, TSCONFIG_DEFAULTS, - CACHE_DIR_NAME + CACHE_DIR_NAME, }; diff --git a/lib/open-report.js b/lib/open-report.js index 2361ec69..6ce16cb6 100644 --- a/lib/open-report.js +++ b/lib/open-report.js @@ -1,3 +1,4 @@ +'use strict'; import openEditor from 'open-editor'; const sortResults = (a, b) => a.errorCount + b.errorCount > 0 ? (a.errorCount - b.errorCount) : (a.warningCount - b.warningCount); @@ -27,7 +28,7 @@ const resultToFile = result => { return { file: result.filePath, line: message.line, - column: message.column + column: message.column, }; }; diff --git a/lib/options-manager.js b/lib/options-manager.js index 456f6327..9c87cb76 100644 --- a/lib/options-manager.js +++ b/lib/options-manager.js @@ -29,7 +29,7 @@ import { CONFIG_FILES, MERGE_OPTIONS_CONCAT, TSCONFIG_DEFAULTS, - CACHE_DIR_NAME + CACHE_DIR_NAME, } from './constants.js'; const {__dirname, json, require} = createEsmUtils(import.meta); @@ -46,7 +46,6 @@ resolveFrom.silent = (moduleId, fromDirectory) => { } catch { } }; -// TODO: Use `import.meta.resolve(normalizePackageName(name))` when supported const resolveLocalConfig = name => resolveModule(normalizePackageName(name, 'eslint-config'), import.meta.url); const nodeVersion = process && process.version; @@ -61,9 +60,9 @@ const DEFAULT_CONFIG = { extends: [ resolveLocalConfig('xo'), path.join(__dirname, '../config/overrides.cjs'), - path.join(__dirname, '../config/plugins.cjs') - ] - } + path.join(__dirname, '../config/plugins.cjs'), + ], + }, }; /** @@ -77,8 +76,8 @@ const getEmptyConfig = () => ({ ignorePatterns: [], env: {}, plugins: [], - extends: [] - } + extends: [], + }, }); const getEmptyXOConfig = () => ({ @@ -87,7 +86,7 @@ const getEmptyXOConfig = () => ({ globals: [], envs: [], plugins: [], - extends: [] + extends: [], }); const mergeFn = (previousValue, value, key) => { @@ -179,7 +178,7 @@ const mergeWithFileConfigs = async (files, options, configFiles) => { configs.set(cacheKey, { files: [file, ...(cachedGroup ? cachedGroup.files : [])], options: cachedGroup ? cachedGroup.options : fileOptions, - prettierOptions + prettierOptions, }); return configs; @@ -195,7 +194,7 @@ const mergeWithFileConfigs = async (files, options, configFiles) => { } return outputJson(cachePath, makeTSConfig(tsConfigs[tsConfigPath], tsConfigPath, files)); - } + }, )); return groups; @@ -209,7 +208,7 @@ Hashing based on https://github.com/eslint/eslint/blob/cf38d0d939b62f3670cdd59f0 */ const getTsConfigCachePath = (files, tsConfigPath) => path.join( cacheLocation, - `tsconfig.${murmur(`${pkg.version}_${nodeVersion}_${stringify({files: files.sort(), tsConfigPath})}`).result().toString(36)}.json` + `tsconfig.${murmur(`${pkg.version}_${nodeVersion}_${stringify({files: files.sort(), tsConfigPath})}`).result().toString(36)}.json`, ); const makeTSConfig = (tsConfig, tsConfigPath, files) => { @@ -237,7 +236,7 @@ const normalizeOptions = options => { 'rule', 'setting', 'extend', - 'extension' + 'extension', ]; for (const singular of aliases) { @@ -269,7 +268,7 @@ const mergeOptions = (options, xoOptions = {}, enginesOptions = {}) => { const mergedOptions = normalizeOptions({ ...xoOptions, ...(enginesOptions && enginesOptions.node && semver.validRange(enginesOptions.node) ? {nodeVersion: enginesOptions.node} : {}), - ...options + ...options, }); mergedOptions.extensions = DEFAULT_EXTENSION.concat(mergedOptions.extensions || []); @@ -296,7 +295,7 @@ const buildConfig = (options, prettierOptions) => { buildXOConfig(options), buildTSConfig(options), buildExtendsConfig(options), - buildPrettierConfig(options, prettierOptions) + buildPrettierConfig(options, prettierOptions), )(mergeWith(getEmptyConfig(), DEFAULT_CONFIG, mergeFn)); }; @@ -306,7 +305,7 @@ const buildESLintConfig = options => config => { if (options.rules) { config.baseConfig.rules = { ...config.baseConfig.rules, - ...options.rules + ...options.rules, }; } @@ -323,41 +322,41 @@ const buildESLintConfig = options => config => { if (options.envs) { config.baseConfig.env = { ...config.baseConfig.env, - ...toValueMap(options.envs) + ...toValueMap(options.envs), }; } if (options.globals) { config.baseConfig.globals = { ...config.baseConfig.globals, - ...toValueMap(options.globals, 'readonly') + ...toValueMap(options.globals, 'readonly'), }; } if (options.plugins) { config.baseConfig.plugins = [ ...config.baseConfig.plugins, - ...options.plugins + ...options.plugins, ]; } if (options.ignores) { config.baseConfig.ignorePatterns = [ ...config.baseConfig.ignorePatterns, - ...options.ignores + ...options.ignores, ]; } if (options.parserOptions) { config.baseConfig.parserOptions = { ...config.baseConfig.parserOptions, - ...options.parserOptions + ...options.parserOptions, }; } return { ...config, - ...pick(options, ['cwd', 'filePath', 'fix']) + ...pick(options, ['cwd', 'filePath', 'fix']), }; }; @@ -402,7 +401,7 @@ const buildXOConfig = options => config => { config.baseConfig.rules['semi-spacing'] = ['error', { before: false, - after: true + after: true, }]; } @@ -474,13 +473,13 @@ const buildPrettierConfig = (options, prettierConfig) => config => { }; const mergeWithPrettierConfig = (options, prettierOptions) => { - if ((options.semicolon === true && prettierOptions.semi === false) || - (options.semicolon === false && prettierOptions.semi === true)) { + if ((options.semicolon === true && prettierOptions.semi === false) + || (options.semicolon === false && prettierOptions.semi === true)) { throw new Error(`The Prettier config \`semi\` is ${prettierOptions.semi} while XO \`semicolon\` is ${options.semicolon}`); } - if (((options.space === true || typeof options.space === 'number') && prettierOptions.useTabs === true) || - ((options.space === false) && prettierOptions.useTabs === false)) { + if (((options.space === true || typeof options.space === 'number') && prettierOptions.useTabs === true) + || ((options.space === false) && prettierOptions.useTabs === false)) { throw new Error(`The Prettier config \`useTabs\` is ${prettierOptions.useTabs} while XO \`space\` is ${options.space}`); } @@ -497,10 +496,10 @@ const mergeWithPrettierConfig = (options, prettierOptions) => { trailingComma: 'none', tabWidth: normalizeSpaces(options), useTabs: !options.space, - semi: options.semicolon !== false + semi: options.semicolon !== false, }, prettierOptions, - mergeFn + mergeFn, ); }; @@ -514,9 +513,9 @@ const buildTSConfig = options => config => { ecmaFeatures: {jsx: true}, project: options.tsConfigPath, projectFolderIgnoreList: - options.parserOptions && options.parserOptions.projectFolderIgnoreList ? - options.parserOptions.projectFolderIgnoreList : - [new RegExp(`/node_modules/(?!.*\\.cache/${CACHE_DIR_NAME})`)] + options.parserOptions && options.parserOptions.projectFolderIgnoreList + ? options.parserOptions.projectFolderIgnoreList + : [new RegExp(`/node_modules/(?!.*\\.cache/${CACHE_DIR_NAME})`)], }; delete config.tsConfigPath; @@ -562,7 +561,7 @@ const findApplicableOverrides = (path, overrides) => { return { hash, - applicable + applicable, }; }; @@ -597,8 +596,8 @@ const gatherImportResolvers = options => { ...resolvers, webpack: { ...resolvers.webpack, - ...webpackResolverSettings - } + ...webpackResolverSettings, + }, }; } @@ -614,5 +613,5 @@ export { mergeWithFileConfig, buildConfig, applyOverrides, - mergeOptions + mergeOptions, }; diff --git a/package.json b/package.json index 6c81e631..a5d604e5 100644 --- a/package.json +++ b/package.json @@ -52,68 +52,64 @@ "typescript" ], "dependencies": { - "@eslint/eslintrc": "^0.4.1", - "@typescript-eslint/eslint-plugin": "^4.22.0", - "@typescript-eslint/parser": "^4.22.0", - "arrify": "^2.0.1", + "@eslint/eslintrc": "^0.4.2", + "@typescript-eslint/eslint-plugin": "^4.28.1", + "@typescript-eslint/parser": "^4.28.1", + "arrify": "^3.0.0", "cosmiconfig": "^7.0.0", "debug": "^4.3.1", - "define-lazy-prop": "^2.0.0", - "eslint": "^7.24.0", - "eslint-config-prettier": "^8.2.0", - "eslint-config-xo": "^0.36.0", - "eslint-config-xo-typescript": "^0.41.0", - "eslint-formatter-pretty": "^4.0.0", - "eslint-import-resolver-webpack": "^0.13.0", + "define-lazy-prop": "^3.0.0", + "eslint": "^7.29.0", + "eslint-config-prettier": "^8.3.0", + "eslint-config-xo": "^0.37.0", + "eslint-config-xo-typescript": "^0.42.0", + "eslint-formatter-pretty": "^4.1.0", + "eslint-import-resolver-webpack": "^0.13.1", "eslint-plugin-ava": "^12.0.0", "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-import": "^2.22.1", + "eslint-plugin-import": "^2.23.4", "eslint-plugin-no-use-extend-native": "^0.5.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-unicorn": "^32.0.0", + "eslint-plugin-unicorn": "^34.0.1", "esm-utils": "^1.1.0", "find-cache-dir": "^3.3.1", "find-up": "^5.0.0", "fs-extra": "^10.0.0", - "get-stdin": "^8.0.0", + "get-stdin": "^9.0.0", "globby": "^9.2.0", "imurmurhash": "^0.1.4", - "is-path-inside": "^3.0.3", + "is-path-inside": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "json5": "^2.2.0", "lodash-es": "^4.17.21", - "meow": "^9.0.0", + "meow": "^10.0.1", "micromatch": "^4.0.4", "open-editor": "^3.0.0", "p-filter": "^2.1.0", - "p-map": "^4.0.0", - "p-reduce": "^2.1.0", + "p-map": "^5.0.0", + "p-reduce": "^3.0.0", "path-exists": "^4.0.0", - "prettier": "^2.2.1", + "prettier": "^2.3.2", "semver": "^7.3.5", - "slash": "^3.0.0", + "slash": "^4.0.0", "to-absolute-glob": "^2.0.2", - "typescript": "^4.2.4" + "typescript": "^4.3.5" }, "devDependencies": { "ava": "^3.15.0", "eslint-config-xo-react": "^0.25.0", - "eslint-plugin-react": "^7.23.2", + "eslint-plugin-react": "^7.24.0", "eslint-plugin-react-hooks": "^4.2.0", - "execa": "^5.0.0", + "execa": "^5.1.1", "nyc": "^15.1.0", "proxyquire": "^2.1.3", - "temp-write": "^4.0.0", - "webpack": "^5.34.0" + "temp-write": "^5.0.0", + "webpack": "^5.41.1" }, "eslintConfig": { - "extends": "eslint-config-xo", - "rules": { - "unicorn/prefer-module": "off", - "unicorn/prefer-node-protocol": "off" - } + "extends": "eslint-config-xo" }, "eslintIgnore": [ "test/fixtures" diff --git a/test/cli.js b/test/cli.js index 7c5a579c..cfee0a66 100644 --- a/test/cli.js +++ b/test/cli.js @@ -19,7 +19,7 @@ test('fix option', async t => { test('fix option with stdin', async t => { const {stdout} = await main(['--fix', '--stdin'], { - input: 'console.log()' + input: 'console.log()', }); t.is(stdout, 'console.log();'); }); @@ -27,7 +27,7 @@ test('fix option with stdin', async t => { test('stdin-filename option with stdin', async t => { const {stdout} = await main(['--stdin', '--stdin-filename=unicorn-file'], { input: 'console.log()\n', - reject: false + reject: false, }); t.regex(stdout, /unicorn-file:/u); }); @@ -36,7 +36,7 @@ test('reporter option', async t => { const filepath = await tempWrite('console.log()\n', 'x.js'); const error = await t.throwsAsync(() => - main(['--reporter=compact', filepath]) + main(['--reporter=compact', filepath]), ); t.true(error.stdout.includes('Error - ')); }); @@ -141,7 +141,7 @@ test('space option as boolean with filename', async t => { const cwd = path.join(__dirname, 'fixtures/space'); const {stdout} = await main(['--reporter=json', '--space', 'two-spaces.js'], { cwd, - reject: false + reject: false, }); const reports = JSON.parse(stdout); @@ -171,14 +171,14 @@ test('extension option', async t => { test('invalid print-config flag with stdin', async t => { const error = await t.throwsAsync(() => - main(['--print-config', 'x.js', '--stdin'], {input: 'console.log()\n'}) + main(['--print-config', 'x.js', '--stdin'], {input: 'console.log()\n'}), ); t.is(error.stderr.trim(), 'The `--print-config` flag is not supported on stdin'); }); test('print-config flag requires a single filename', async t => { const error = await t.throwsAsync(() => - main(['--print-config', 'x.js', 'y.js']) + main(['--print-config', 'x.js', 'y.js']), ); t.is(error.stderr.trim(), 'The `--print-config` flag must be used with exactly one filename'); }); diff --git a/test/fixtures/space/one-space.js b/test/fixtures/space/one-space.js index 0b1b5e7d..cf203662 100644 --- a/test/fixtures/space/one-space.js +++ b/test/fixtures/space/one-space.js @@ -1,3 +1,3 @@ console.log([ - 1 + 1, ]); diff --git a/test/fixtures/space/two-spaces.js b/test/fixtures/space/two-spaces.js index baa2c240..6b010f41 100644 --- a/test/fixtures/space/two-spaces.js +++ b/test/fixtures/space/two-spaces.js @@ -1,3 +1,3 @@ console.log([ - 1 + 1, ]); diff --git a/test/fixtures/typescript/child/sub-child/four-spaces.ts b/test/fixtures/typescript/child/sub-child/four-spaces.ts index 39806b0b..9b5220b1 100644 --- a/test/fixtures/typescript/child/sub-child/four-spaces.ts +++ b/test/fixtures/typescript/child/sub-child/four-spaces.ts @@ -1,3 +1,3 @@ console.log([ - 4 + 4, ]); diff --git a/test/fixtures/typescript/two-spaces.tsx b/test/fixtures/typescript/two-spaces.tsx index 70a5ead6..5984f43a 100644 --- a/test/fixtures/typescript/two-spaces.tsx +++ b/test/fixtures/typescript/two-spaces.tsx @@ -1,3 +1,3 @@ console.log([ - 2 + 2, ]); diff --git a/test/lint-files.js b/test/lint-files.js index 1d0c4446..4cceaf48 100644 --- a/test/lint-files.js +++ b/test/lint-files.js @@ -110,16 +110,16 @@ test('enable rules based on nodeVersion', async t => { hasRule( results, path.resolve('fixtures/engines-overrides/promise-then-transpile.js'), - 'promise/prefer-await-to-then' - ) + 'promise/prefer-await-to-then', + ), ); // The non transpiled files can use `.then` t.false( hasRule( results, path.resolve('fixtures/engines-overrides/promise-then.js'), - 'promise/prefer-await-to-then' - ) + 'promise/prefer-await-to-then', + ), ); }); @@ -141,32 +141,32 @@ test('find configurations close to linted file', async t => { hasRule( results, path.resolve('fixtures/nested-configs/child/semicolon.js'), - 'semi' - ) + 'semi', + ), ); t.true( hasRule( results, path.resolve('fixtures/nested-configs/child-override/child-prettier-override/semicolon.js'), - 'prettier/prettier' - ) + 'prettier/prettier', + ), ); t.true( hasRule( results, path.resolve('fixtures/nested-configs/no-semicolon.js'), - 'semi' - ) + 'semi', + ), ); t.true( hasRule( results, path.resolve('fixtures/nested-configs/child-override/two-spaces.js'), - 'indent' - ) + 'indent', + ), ); }); @@ -177,24 +177,24 @@ test('typescript files', async t => { hasRule( results, path.resolve('fixtures/typescript/two-spaces.tsx'), - '@typescript-eslint/indent' - ) + '@typescript-eslint/indent', + ), ); t.true( hasRule( results, path.resolve('fixtures/typescript/child/extra-semicolon.ts'), - '@typescript-eslint/no-extra-semi' - ) + '@typescript-eslint/no-extra-semi', + ), ); t.true( hasRule( results, path.resolve('fixtures/typescript/child/sub-child/four-spaces.ts'), - '@typescript-eslint/indent' - ) + '@typescript-eslint/indent', + ), ); }); @@ -218,8 +218,8 @@ test('webpack import resolver is used if webpack.config.js is found', async t => const {results} = await xo.lintFiles(path.resolve(cwd, 'file1.js'), { cwd, rules: { - 'import/no-unresolved': 2 - } + 'import/no-unresolved': 2, + }, }); t.is(results[0].errorCount, 1, JSON.stringify(results[0].messages)); @@ -237,14 +237,14 @@ test('webpack import resolver config can be passed through webpack option', asyn config: { resolve: { alias: { - file2alias: path.resolve(__dirname, cwd, './file2.js') - } - } - } + file2alias: path.resolve(__dirname, cwd, './file2.js'), + }, + }, + }, }, rules: { - 'import/no-unresolved': 2 - } + 'import/no-unresolved': 2, + }, }); t.is(results[0].errorCount, 1, JSON.stringify(results[0].messages)); @@ -258,8 +258,8 @@ test('webpack import resolver is used if {webpack: true}', async t => { webpack: true, rules: { 'import/no-unresolved': 2, - 'import/no-webpack-loader-syntax': 0 - } + 'import/no-webpack-loader-syntax': 0, + }, }); t.is(results[0].errorCount, 0, JSON.stringify(results[0])); @@ -272,8 +272,8 @@ async function configType(t, {dir}) { hasRule( results, path.resolve('fixtures', 'config-files', dir, 'file.js'), - 'indent' - ) + 'indent', + ), ); } diff --git a/test/lint-text.js b/test/lint-text.js index cec122cb..615afb85 100644 --- a/test/lint-text.js +++ b/test/lint-text.js @@ -16,7 +16,7 @@ test('.lintText()', async t => { test('default `ignores`', async t => { const result = await xo.lintText('\'use strict\'\nconsole.log(\'unicorn\');\n', { - filePath: 'node_modules/ignored/index.js' + filePath: 'node_modules/ignored/index.js', }); t.is(result.errorCount, 0); t.is(result.warningCount, 0); @@ -25,7 +25,7 @@ test('default `ignores`', async t => { test('`ignores` option', async t => { const result = await xo.lintText('\'use strict\'\nconsole.log(\'unicorn\');\n', { filePath: 'ignored/index.js', - ignores: ['ignored/**/*.js'] + ignores: ['ignored/**/*.js'], }); t.is(result.errorCount, 0); t.is(result.warningCount, 0); @@ -34,7 +34,7 @@ test('`ignores` option', async t => { test('`ignores` option without cwd', async t => { const result = await xo.lintText('\'use strict\'\nconsole.log(\'unicorn\');\n', { filePath: 'ignored/index.js', - ignores: ['ignored/**/*.js'] + ignores: ['ignored/**/*.js'], }); t.is(result.errorCount, 0); t.is(result.warningCount, 0); @@ -47,13 +47,13 @@ test('respect overrides', async t => { overrides: [ { files: ['ignored/**/*.js'], - ignores: [] - } + ignores: [], + }, ], rules: { 'unicorn/prefer-module': 'off', - 'unicorn/prefer-node-protocol': 'off' - } + 'unicorn/prefer-node-protocol': 'off', + }, }); t.is(result.errorCount, 1); t.is(result.warningCount, 0); @@ -65,9 +65,9 @@ test('overriden ignore', async t => { overrides: [ { files: ['unignored.js'], - ignores: ['unignored.js'] - } - ] + ignores: ['unignored.js'], + }, + ], }); t.is(result.errorCount, 0); t.is(result.warningCount, 0); @@ -76,7 +76,7 @@ test('overriden ignore', async t => { test('`ignores` option without filename', async t => { await t.throwsAsync(async () => { await xo.lintText('\'use strict\'\nconsole.log(\'unicorn\');\n', { - ignores: ['ignored/**/*.js'] + ignores: ['ignored/**/*.js'], }); }, {message: /The `ignores` option requires the `filePath` option to be defined./u}); }); @@ -89,7 +89,7 @@ test('JSX support', async t => { test('plugin support', async t => { const {results} = await xo.lintText('var React;\nReact.render();\n', { plugins: ['react'], - rules: {'react/jsx-no-undef': 'error'} + rules: {'react/jsx-no-undef': 'error'}, }); t.true(hasRule(results, 'react/jsx-no-undef')); }); @@ -101,7 +101,7 @@ test('prevent use of extended native objects', async t => { test('extends support', async t => { const {results} = await xo.lintText('var React;\nReact.render();\n', { - extends: 'xo-react' + extends: 'xo-react', }); t.true(hasRule(results, 'react/jsx-no-undef')); }); @@ -130,7 +130,7 @@ test('extends `react` support with `prettier` option', async t => { test('regression test for #71', async t => { const {results} = await xo.lintText('const foo = { key: \'value\' };\nconsole.log(foo);\n', { - extends: path.join(__dirname, 'fixtures/extends.js') + extends: path.join(__dirname, 'fixtures/extends.js'), }); t.is(results[0].errorCount, 0); }); @@ -227,9 +227,9 @@ test('enable rules based on nodeVersion in override', async t => { overrides: [ { files: 'promise-*.js', - nodeVersion: '>=6.0.0' - } - ] + nodeVersion: '>=6.0.0', + }, + ], }); t.false(hasRule(results, 'promise/prefer-await-to-then')); @@ -239,9 +239,9 @@ test('enable rules based on nodeVersion in override', async t => { overrides: [ { files: 'promise-*.js', - nodeVersion: '>=8.0.0' - } - ] + nodeVersion: '>=8.0.0', + }, + ], })); t.true(hasRule(results, 'promise/prefer-await-to-then')); }); @@ -278,14 +278,14 @@ test('find configurations close to linted file', async t => { test('typescript files', async t => { let {results} = await xo.lintText(`console.log([ - 2 + 2, ]); `, {filePath: 'fixtures/typescript/two-spaces.tsx'}); t.true(hasRule(results, '@typescript-eslint/indent')); ({results} = await xo.lintText(`console.log([ - 2 + 2, ]); `, {filePath: 'fixtures/typescript/two-spaces.tsx', space: 2})); t.is(results[0].errorCount, 0); @@ -297,13 +297,13 @@ test('typescript files', async t => { t.is(results[0].errorCount, 0); ({results} = await xo.lintText(`console.log([ - 4 + 4, ]); `, {filePath: 'fixtures/typescript/child/sub-child/four-spaces.ts'})); t.true(hasRule(results, '@typescript-eslint/indent')); ({results} = await xo.lintText(`console.log([ - 4 + 4, ]); `, {filePath: 'fixtures/typescript/child/sub-child/four-spaces.ts', space: 4})); t.is(results[0].errorCount, 0); diff --git a/test/open-report.js b/test/open-report.js index f8e1688d..02c57a2d 100644 --- a/test/open-report.js +++ b/test/open-report.js @@ -16,7 +16,7 @@ test.skip('opens nothing when there are no errors nor warnings', async t => { if (files.length !== 0) { t.fail(); } - } + }, }); openReport(results); @@ -31,24 +31,24 @@ test.skip('only opens errors if there are errors and warnings', async t => { { file: path.join(__dirname, 'fixtures/open-report/errors/one.js'), line: 1, - column: 7 + column: 7, }, { file: path.join(__dirname, 'fixtures/open-report/errors/two-with-warnings.js'), line: 1, - column: 1 + column: 1, }, { file: path.join(__dirname, 'fixtures/open-report/errors/three.js'), line: 1, - column: 7 - } + column: 7, + }, ]; const openReport = proxyquire('../lib/open-report', { 'open-editor': files => { t.deepEqual(files, expected); - } + }, }); openReport(results); }); @@ -61,12 +61,12 @@ test.skip('if a file has errors and warnings, it opens the first error', async t { file: path.join(__dirname, 'fixtures/open-report/errors/two-with-warnings.js'), line: 1, - column: 1 - } + column: 1, + }, ]; const openReport = proxyquire('../lib/open-report', { - 'open-editor': files => t.deepEqual(files, expected) + 'open-editor': files => t.deepEqual(files, expected), }); openReport(results); }); @@ -79,17 +79,17 @@ test.skip('only opens warnings if there are no errors', async t => { { file: path.join(__dirname, 'fixtures/open-report/warnings/one.js'), line: 1, - column: 1 + column: 1, }, { file: path.join(__dirname, 'fixtures/open-report/warnings/three.js'), line: 1, - column: 1 - } + column: 1, + }, ]; const openReport = proxyquire('../lib/open-report', { - 'open-editor': files => t.deepEqual(files, expected) + 'open-editor': files => t.deepEqual(files, expected), }); openReport(results); }); diff --git a/test/options-manager.js b/test/options-manager.js index 2d3f8fd0..f8e38ddf 100644 --- a/test/options-manager.js +++ b/test/options-manager.js @@ -25,34 +25,34 @@ test('normalizeOptions: makes all the options plural and arrays', t => { rule: {'my-rule': 'foo'}, setting: {'my-rule': 'bar'}, extend: 'foo', - extension: 'html' + extension: 'html', }); t.deepEqual(options, { envs: [ - 'node' + 'node', ], extends: [ - 'foo' + 'foo', ], extensions: [ - 'html' + 'html', ], globals: [ - 'foo' + 'foo', ], ignores: [ - 'test.js' + 'test.js', ], plugins: [ - 'my-plugin' + 'my-plugin', ], rules: { - 'my-rule': 'foo' + 'my-rule': 'foo', }, settings: { - 'my-rule': 'bar' - } + 'my-rule': 'bar', + }, }); }); @@ -97,7 +97,7 @@ test('buildConfig: prettier: true', t => { semi: true, singleQuote: true, tabWidth: 2, - trailingComma: 'none' + trailingComma: 'none', }]); // eslint-prettier-config must always be last t.is(config.baseConfig.extends[config.baseConfig.extends.length - 1], 'prettier'); @@ -122,7 +122,7 @@ test('buildConfig: prettier: true, typescript file', t => { semi: true, singleQuote: true, tabWidth: 2, - trailingComma: 'none' + trailingComma: 'none', }]); // eslint-prettier-config must always be last @@ -148,7 +148,7 @@ test('buildConfig: prettier: true, semicolon: false', t => { semi: false, singleQuote: true, tabWidth: 2, - trailingComma: 'none' + trailingComma: 'none', }]); // Indent rule is not enabled t.is(config.baseConfig.rules.indent, undefined); @@ -169,7 +169,7 @@ test('buildConfig: prettier: true, space: 4', t => { semi: true, singleQuote: true, tabWidth: 4, - trailingComma: 'none' + trailingComma: 'none', }]); // Indent rule is not enabled t.is(config.baseConfig.rules.indent, undefined); @@ -190,7 +190,7 @@ test('buildConfig: prettier: true, space: true', t => { semi: true, singleQuote: true, tabWidth: 2, - trailingComma: 'none' + trailingComma: 'none', }]); // Indent rule is not enabled t.is(config.baseConfig.rules.indent, undefined); @@ -252,7 +252,7 @@ test('buildConfig: nodeVersion: >=6', t => { t.deepEqual(config.baseConfig.rules['node/no-unsupported-features/es-builtins'], ['error', {version: '>=6'}]); t.deepEqual( config.baseConfig.rules['node/no-unsupported-features/es-syntax'], - ['error', {version: '>=6', ignores: ['modules']}] + ['error', {version: '>=6', ignores: ['modules']}], ); t.deepEqual(config.baseConfig.rules['node/no-unsupported-features/node-builtins'], ['error', {version: '>=6'}]); }); @@ -266,7 +266,7 @@ test('buildConfig: nodeVersion: >=8', t => { t.deepEqual(config.baseConfig.rules['node/no-unsupported-features/es-builtins'], ['error', {version: '>=8'}]); t.deepEqual( config.baseConfig.rules['node/no-unsupported-features/es-syntax'], - ['error', {version: '>=8', ignores: ['modules']}] + ['error', {version: '>=8', ignores: ['modules']}], ); t.deepEqual(config.baseConfig.rules['node/no-unsupported-features/node-builtins'], ['error', {version: '>=8'}]); }); @@ -276,7 +276,7 @@ test('mergeWithPrettierConfig: use `singleQuote`, `trailingComma`, `bracketSpaci singleQuote: false, trailingComma: 'all', bracketSpacing: false, - jsxBracketSameLine: false + jsxBracketSameLine: false, }; const result = manager.mergeWithPrettierConfig({}, prettierOptions); const expected = { @@ -284,7 +284,7 @@ test('mergeWithPrettierConfig: use `singleQuote`, `trailingComma`, `bracketSpaci ...prettierOptions, tabWidth: 2, useTabs: true, - semi: true + semi: true, }; t.deepEqual(result, expected); }); @@ -293,7 +293,7 @@ test('mergeWithPrettierConfig: determine `tabWidth`, `useTabs`, `semi` from xo c const prettierOptions = { tabWidth: 4, useTabs: false, - semi: false + semi: false, }; const result = manager.mergeWithPrettierConfig({space: 4, semicolon: false}, {}); const expected = { @@ -301,7 +301,7 @@ test('mergeWithPrettierConfig: determine `tabWidth`, `useTabs`, `semi` from xo c jsxBracketSameLine: false, singleQuote: true, trailingComma: 'none', - ...prettierOptions + ...prettierOptions, }; t.deepEqual(result, expected); }); @@ -310,7 +310,7 @@ test('mergeWithPrettierConfig: determine `tabWidth`, `useTabs`, `semi` from pret const prettierOptions = { useTabs: false, semi: false, - tabWidth: 4 + tabWidth: 4, }; const result = manager.mergeWithPrettierConfig({}, prettierOptions); const expected = { @@ -318,7 +318,7 @@ test('mergeWithPrettierConfig: determine `tabWidth`, `useTabs`, `semi` from pret jsxBracketSameLine: false, singleQuote: true, trailingComma: 'none', - ...prettierOptions + ...prettierOptions, }; t.deepEqual(result, expected); }); @@ -326,16 +326,16 @@ test('mergeWithPrettierConfig: determine `tabWidth`, `useTabs`, `semi` from pret test('mergeWithPrettierConfig: throw error is `semi`/`semicolon` conflicts', t => { t.throws(() => manager.mergeWithPrettierConfig( {semicolon: true}, - {semi: false} + {semi: false}, )); t.throws(() => manager.mergeWithPrettierConfig( {semicolon: false}, - {semi: true} + {semi: true}, )); t.notThrows(() => manager.mergeWithPrettierConfig( {semicolon: true}, - {semi: true} + {semi: true}, )); t.notThrows(() => manager.mergeWithPrettierConfig({semicolon: false}, {semi: false})); }); @@ -416,13 +416,13 @@ test('buildConfig: extends', t => { const config = manager.buildConfig({ extends: [ 'plugin:foo/bar', - 'eslint-config-prettier' - ] + 'eslint-config-prettier', + ], }); t.deepEqual(config.baseConfig.extends.slice(-2), [ 'plugin:foo/bar', - path.resolve('../node_modules/eslint-config-prettier/index.js') + path.resolve('../node_modules/eslint-config-prettier/index.js'), ]); }); @@ -435,7 +435,7 @@ test('buildConfig: typescript', t => { warnOnUnsupportedTypeScriptVersion: false, ecmaFeatures: {jsx: true}, project: './tsconfig.json', - projectFolderIgnoreList: [/\/node_modules\/(?!.*\.cache\/xo-linter)/] + projectFolderIgnoreList: [/\/node_modules\/(?!.*\.cache\/xo-linter)/], }); }); @@ -443,7 +443,7 @@ test('buildConfig: typescript with parserOption', t => { const config = manager.buildConfig({ ts: true, parserOptions: {projectFolderIgnoreList: [], sourceType: 'script'}, - tsConfigPath: 'path/to/tmp-tsconfig.json' + tsConfigPath: 'path/to/tmp-tsconfig.json', }, {}); t.is(config.baseConfig.parser, require.resolve('@typescript-eslint/parser')); @@ -452,15 +452,15 @@ test('buildConfig: typescript with parserOption', t => { ecmaFeatures: {jsx: true}, projectFolderIgnoreList: [], project: 'path/to/tmp-tsconfig.json', - sourceType: 'script' + sourceType: 'script', }); }); test('buildConfig: parserOptions', t => { const config = manager.buildConfig({ parserOptions: { - sourceType: 'script' - } + sourceType: 'script', + }, }); t.is(config.baseConfig.parserOptions.sourceType, 'script'); @@ -469,11 +469,11 @@ test('buildConfig: parserOptions', t => { test('buildConfig: prevents useEslintrc option', t => { t.throws(() => { manager.buildConfig({ - useEslintrc: true + useEslintrc: true, }); }, { instanceOf: Error, - message: 'The `useEslintrc` option is not supported' + message: 'The `useEslintrc` option is not supported', }); }); @@ -482,13 +482,13 @@ test('findApplicableOverrides', t => { {files: '**/f*.js'}, {files: '**/bar.js'}, {files: '**/*oo.js'}, - {files: '**/*.txt'} + {files: '**/*.txt'}, ]); t.is(result.hash, 0b1010); t.deepEqual(result.applicable, [ {files: '**/f*.js'}, - {files: '**/*oo.js'} + {files: '**/*oo.js'}, ]); }); @@ -551,13 +551,13 @@ test('mergeWithFileConfig: typescript files', async t => { ignores: DEFAULT_IGNORES, cwd, semicolon: false, - ts: true + ts: true, }; t.deepEqual(omit(options, 'tsConfigPath'), expected); t.deepEqual(await readJson(options.tsConfigPath), { extends: path.resolve(cwd, 'tsconfig.json'), files: [path.resolve(cwd, 'file.ts')], - include: [slash(path.resolve(cwd, '**/*.ts')), slash(path.resolve(cwd, '**/*.tsx'))] + include: [slash(path.resolve(cwd, '**/*.ts')), slash(path.resolve(cwd, '**/*.tsx'))], }); }); @@ -571,13 +571,13 @@ test('mergeWithFileConfig: tsx files', async t => { ignores: DEFAULT_IGNORES, cwd, semicolon: false, - ts: true + ts: true, }; t.deepEqual(omit(options, 'tsConfigPath'), expected); t.deepEqual(await readJson(options.tsConfigPath), { extends: path.resolve(cwd, 'tsconfig.json'), files: [path.resolve(cwd, 'file.tsx')], - include: [slash(path.resolve(cwd, '**/*.ts')), slash(path.resolve(cwd, '**/*.tsx'))] + include: [slash(path.resolve(cwd, '**/*.ts')), slash(path.resolve(cwd, '**/*.tsx'))], }); }); @@ -587,19 +587,19 @@ test('mergeWithFileConfigs: nested configs with prettier', async t => { 'no-semicolon.js', 'child/semicolon.js', 'child-override/two-spaces.js', - 'child-override/child-prettier-override/semicolon.js' + 'child-override/child-prettier-override/semicolon.js', ].map(file => path.resolve(cwd, file)); const result = await manager.mergeWithFileConfigs(paths, {cwd}, [ { filepath: path.resolve(cwd, 'child-override', 'child-prettier-override', 'package.json'), - config: {overrides: [{files: 'semicolon.js', prettier: true}]} + config: {overrides: [{files: 'semicolon.js', prettier: true}]}, }, {filepath: path.resolve(cwd, 'package.json'), config: {semicolon: true}}, { filepath: path.resolve(cwd, 'child-override', 'package.json'), - config: {overrides: [{files: 'two-spaces.js', space: 4}]} + config: {overrides: [{files: 'two-spaces.js', space: 4}]}, }, - {filepath: path.resolve(cwd, 'child', 'package.json'), config: {semicolon: false}} + {filepath: path.resolve(cwd, 'child', 'package.json'), config: {semicolon: false}}, ]); t.deepEqual(result, [ @@ -609,9 +609,9 @@ test('mergeWithFileConfigs: nested configs with prettier', async t => { semicolon: true, cwd, extensions: DEFAULT_EXTENSION, - ignores: DEFAULT_IGNORES + ignores: DEFAULT_IGNORES, }, - prettierOptions: {} + prettierOptions: {}, }, { files: [path.resolve(cwd, 'child/semicolon.js')], @@ -619,9 +619,9 @@ test('mergeWithFileConfigs: nested configs with prettier', async t => { semicolon: false, cwd: path.resolve(cwd, 'child'), extensions: DEFAULT_EXTENSION, - ignores: DEFAULT_IGNORES + ignores: DEFAULT_IGNORES, }, - prettierOptions: {} + prettierOptions: {}, }, { files: [path.resolve(cwd, 'child-override/two-spaces.js')], @@ -635,9 +635,9 @@ test('mergeWithFileConfigs: nested configs with prettier', async t => { extends: [], cwd: path.resolve(cwd, 'child-override'), extensions: DEFAULT_EXTENSION, - ignores: DEFAULT_IGNORES + ignores: DEFAULT_IGNORES, }, - prettierOptions: {} + prettierOptions: {}, }, { files: [path.resolve(cwd, 'child-override/child-prettier-override/semicolon.js')], @@ -651,10 +651,10 @@ test('mergeWithFileConfigs: nested configs with prettier', async t => { extends: [], cwd: path.resolve(cwd, 'child-override', 'child-prettier-override'), extensions: DEFAULT_EXTENSION, - ignores: DEFAULT_IGNORES + ignores: DEFAULT_IGNORES, }, - prettierOptions: {endOfLine: 'lf', semi: false, useTabs: true} - } + prettierOptions: {endOfLine: 'lf', semi: false, useTabs: true}, + }, ]); }); @@ -664,7 +664,7 @@ test('mergeWithFileConfigs: typescript files', async t => { const configFiles = [ {filepath: path.resolve(cwd, 'child/sub-child/package.json'), config: {space: 2}}, {filepath: path.resolve(cwd, 'package.json'), config: {space: 4}}, - {filepath: path.resolve(cwd, 'child/package.json'), config: {semicolon: false}} + {filepath: path.resolve(cwd, 'child/package.json'), config: {semicolon: false}}, ]; const result = await manager.mergeWithFileConfigs(paths, {cwd}, configFiles); @@ -675,9 +675,9 @@ test('mergeWithFileConfigs: typescript files', async t => { cwd, extensions: DEFAULT_EXTENSION, ignores: DEFAULT_IGNORES, - ts: true + ts: true, }, - prettierOptions: {} + prettierOptions: {}, }); t.deepEqual(await readJson(result[0].options.tsConfigPath), { files: [path.resolve(cwd, 'two-spaces.tsx')], @@ -688,8 +688,8 @@ test('mergeWithFileConfigs: typescript files', async t => { noUnusedLocals: true, noUnusedParameters: true, strict: true, - target: 'es2018' - } + target: 'es2018', + }, }); t.deepEqual(omit(result[1], 'options.tsConfigPath'), { @@ -699,9 +699,9 @@ test('mergeWithFileConfigs: typescript files', async t => { cwd: path.resolve(cwd, 'child'), extensions: DEFAULT_EXTENSION, ignores: DEFAULT_IGNORES, - ts: true + ts: true, }, - prettierOptions: {} + prettierOptions: {}, }); t.deepEqual(omit(result[2], 'options.tsConfigPath'), { @@ -711,9 +711,9 @@ test('mergeWithFileConfigs: typescript files', async t => { cwd: path.resolve(cwd, 'child/sub-child'), extensions: DEFAULT_EXTENSION, ignores: DEFAULT_IGNORES, - ts: true + ts: true, }, - prettierOptions: {} + prettierOptions: {}, }); // Verify that we use the same temporary tsconfig.json for both files group sharing the same original tsconfig.json even if they have different xo config @@ -723,8 +723,8 @@ test('mergeWithFileConfigs: typescript files', async t => { files: [path.resolve(cwd, 'child/extra-semicolon.ts'), path.resolve(cwd, 'child/sub-child/four-spaces.ts')], include: [ slash(path.resolve(cwd, 'child/**/*.ts')), - slash(path.resolve(cwd, 'child/**/*.tsx')) - ] + slash(path.resolve(cwd, 'child/**/*.tsx')), + ], }); const secondResult = await manager.mergeWithFileConfigs(paths, {cwd}, configFiles); @@ -745,14 +745,14 @@ test('applyOverrides', t => { rules: {'rule-2': 'c'}, extends: ['overrride-extend'], globals: ['override'], - plugins: ['override-plugin'] - } + plugins: ['override-plugin'], + }, ], rules: {'rule-1': 'a', 'rule-2': 'b'}, extends: ['base-extend'], globals: ['base'], plugins: ['base-plugin'], - cwd: '.' + cwd: '.', }), { options: { @@ -762,9 +762,9 @@ test('applyOverrides', t => { plugins: ['base-plugin', 'override-plugin'], envs: [], settings: {}, - cwd: '.' + cwd: '.', }, - hash: 1 - } + hash: 1, + }, ); });