From d8b2e2af37166e467a29ffd73a81a28954642fa4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 15 Jul 2023 20:53:50 -0400 Subject: [PATCH] Update dependency prettier to v3 (#454) * Update dependency prettier to v3 * Run prettier --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Ryan Zimmerman --- index.js | 24 +++++++++---------- lib/args.js | 10 ++++---- package.json | 2 +- test/base.js | 4 ++-- test/config.js | 16 ++++++------- test/error.js | 10 ++++---- test/glob.js | 6 ++--- test/helpers/cli.js | 2 +- test/helpers/read.js | 2 +- test/misc.js | 2 +- test/stdin.js | 2 +- test/stdout.js | 4 ++-- test/watch.js | 56 ++++++++++++++++++++++---------------------- 13 files changed, 70 insertions(+), 70 deletions(-) diff --git a/index.js b/index.js index da052ce..f77bf04 100755 --- a/index.js +++ b/index.js @@ -50,7 +50,7 @@ async function buildCliConfig() { if (e.name && e.name !== 'Error') prefix += `: ${e.name}` return error(`Plugin Error${prefix}: ${msg}'`) } - }) + }), ) : [], } @@ -88,13 +88,13 @@ buildCliConfig() if (input && input.length) { return globby( input.map((i) => slash(String(i))), - { dot: argv.includeDotfiles } + { dot: argv.includeDotfiles }, ) } if (argv.replace || argv.dir) { error( - 'Input Error: Cannot use --dir or --replace when reading from stdin' + 'Input Error: Cannot use --dir or --replace when reading from stdin', ) } @@ -111,7 +111,7 @@ buildCliConfig() if (i.length > 1 && !argv.dir && !argv.replace) { error( - 'Input Error: Must use --dir or --replace with multiple input files' + 'Input Error: Must use --dir or --replace with multiple input files', ) } @@ -146,7 +146,7 @@ buildCliConfig() .concat(getAncestorDirs(file).flatMap(depGraph.dependantsOf)) recompile = recompile.concat( - dependants.filter((file) => input.includes(file)) + dependants.filter((file) => input.includes(file)), ) if (!recompile.length) recompile = input @@ -171,7 +171,7 @@ function rc(ctx, path) { .then((rc) => { if (rc.options.from || rc.options.to) { error( - 'Config Error: Can not set from or to options in config file, use CLI arguments instead' + 'Config Error: Can not set from or to options in config file, use CLI arguments instead', ) } configFile = rc.file @@ -195,7 +195,7 @@ function files(files) { } return read(file).then((content) => css(content, file)) - }) + }), ) } @@ -246,7 +246,7 @@ function css(css, file) { if (!options.to && config.options.map && !config.options.map.inline) { error( - 'Output Error: Cannot output external sourcemaps when writing to STDOUT' + 'Output Error: Cannot output external sourcemaps when writing to STDOUT', ) } @@ -268,8 +268,8 @@ function css(css, file) { const prettyTime = prettyHrtime(process.hrtime(time)) printVerbose( pc.green( - `Finished ${pc.bold(relativePath)} in ${pc.bold(prettyTime)}` - ) + `Finished ${pc.bold(relativePath)} in ${pc.bold(prettyTime)}`, + ), ) const messages = result.warnings() @@ -303,7 +303,7 @@ function dependencies(results) { result.messages .filter((msg) => - msg.type === 'dependency' || msg.type === 'dir-dependency' ? msg : '' + msg.type === 'dependency' || msg.type === 'dir-dependency' ? msg : '', ) .map(depGraph.add) .forEach((dependency) => { @@ -311,7 +311,7 @@ function dependencies(results) { messages.push( dependency.glob ? path.join(dependency.dir, dependency.glob) - : dependency.dir + : dependency.dir, ) } else { messages.push(dependency.file) diff --git a/lib/args.js b/lib/args.js index 35f0e83..12d14fa 100644 --- a/lib/args.js +++ b/lib/args.js @@ -7,11 +7,11 @@ const { argv } = yargs(process.argv.slice(2)) $0 ... [OPTIONS] --dir [--watch|-w] $0 [OPTIONS] --dir [--watch|-w] $0 [OPTIONS] --dir [--watch|-w] - $0 ... [OPTIONS] --replace` + $0 ... [OPTIONS] --replace`, ) .group( ['o', 'd', 'r', 'map', 'no-map', 'watch', 'verbose', 'env'], - 'Basic options:' + 'Basic options:', ) .option('o', { alias: 'output', @@ -50,7 +50,7 @@ const { argv } = yargs(process.argv.slice(2)) }) .group( ['u', 'parser', 'stringifier', 'syntax'], - 'Options for use without a config file:' + 'Options for use without a config file:', ) .option('u', { alias: 'use', @@ -98,7 +98,7 @@ const { argv } = yargs(process.argv.slice(2)) .example('$0 src/**/*.css --base src --dir build', 'Glob Pattern & output') .example( 'cat input.css | $0 -u autoprefixer > output.css', - 'Piping input & output' + 'Piping input & output', ) .epilog( `If no input files are passed, it reads from stdin. If neither -o, --dir, or --replace is passed, it writes to stdout. @@ -107,7 +107,7 @@ If there are multiple input files, the --dir or --replace option must be passed. Input files may contain globs (e.g. src/**/*.css). If you pass an input directory, it will process all files in the directory and any subdirectories, respecting the glob pattern. -For more details, please see https://github.com/postcss/postcss-cli` +For more details, please see https://github.com/postcss/postcss-cli`, ) if (argv.ext && argv.ext.indexOf('.') !== 0) argv.ext = `.${argv.ext}` diff --git a/package.json b/package.json index bb7e8d7..190bf99 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "eslint-config-problems": "7.0.1", "postcss": "^8.0.4", "postcss-import": "^15.0.0", - "prettier": "~2.8.0", + "prettier": "~3.0.0", "sugarss": "^4.0.0", "uuid": "^9.0.0" }, diff --git a/test/base.js b/test/base.js index 496ca14..a0f965c 100644 --- a/test/base.js +++ b/test/base.js @@ -21,11 +21,11 @@ test('--base --dir works', async (t) => { t.is( await read(path.join(dir, 'level-1/level-2/a.css')), - await read('test/fixtures/base/level-1/level-2/a.css') + await read('test/fixtures/base/level-1/level-2/a.css'), ) t.is( await read(path.join(dir, 'level-1/b.css')), - await read('test/fixtures/base/level-1/b.css') + await read('test/fixtures/base/level-1/b.css'), ) }) diff --git a/test/config.js b/test/config.js index d75449c..b1d7c2c 100644 --- a/test/config.js +++ b/test/config.js @@ -17,14 +17,14 @@ test('supports common config', async (t) => { const { error, stderr } = await cli( ['a.css', '-o', 'output.css', '--no-map'], - dir + dir, ) t.falsy(error, stderr) t.is( await read(path.join(dir, 'output.css')), - await read('test/fixtures/a.css') + await read('test/fixtures/a.css'), ) }) @@ -42,14 +42,14 @@ test('supports ESM config', async (t) => { const { error, stderr } = await cli( ['a.css', '-o', 'output.css', '--no-map'], - dir + dir, ) t.falsy(error, stderr) t.is( await read(path.join(dir, 'output.css')), - await read('test/fixtures/a.css') + await read('test/fixtures/a.css'), ) }) @@ -60,14 +60,14 @@ test("doesn't error on empty config", async (t) => { const { error, stderr } = await cli( ['a.css', '-o', 'output.css', '--no-map'], - dir + dir, ) t.falsy(error, stderr) t.is( await read(path.join(dir, 'output.css')), - await read('test/fixtures/a.css') + await read('test/fixtures/a.css'), ) }) @@ -82,7 +82,7 @@ test('errors if `to` is set', async (t) => { t.regex( stderr, - /Config Error: Can not set from or to options in config file, use CLI arguments instead/ + /Config Error: Can not set from or to options in config file, use CLI arguments instead/, ) }) @@ -97,6 +97,6 @@ test('errors if `from` is set', async (t) => { t.regex( stderr, - /Config Error: Can not set from or to options in config file, use CLI arguments instead/ + /Config Error: Can not set from or to options in config file, use CLI arguments instead/, ) }) diff --git a/test/error.js b/test/error.js index 9901f47..5ff67ef 100644 --- a/test/error.js +++ b/test/error.js @@ -22,7 +22,7 @@ test('--map && writing to stdout', (t) => { t.is(code, 1, 'expected non-zero error code') t.regex( error.toString(), - /Output Error: Cannot output external sourcemaps when writing to STDOUT/ + /Output Error: Cannot output external sourcemaps when writing to STDOUT/, ) }) }) @@ -33,9 +33,9 @@ test('plugin not found', (t) => { t.is(code, 1, 'expected non-zero error code') t.regex( error.toString(), - /Plugin Error: Cannot find package 'postcss-plugin'/ + /Plugin Error: Cannot find package 'postcss-plugin'/, ) - } + }, ) }) @@ -58,8 +58,8 @@ test('CssSyntaxError', (t) => { t.is(code, 1, 'expected non-zero error code') t.regex( error.toString(), - /CssSyntaxError: .*a.css:1:4: Unnecessary curly bracket/ + /CssSyntaxError: .*a.css:1:4: Unnecessary curly bracket/, ) - } + }, ) }) diff --git a/test/glob.js b/test/glob.js index 33917ad..863fc39 100644 --- a/test/glob.js +++ b/test/glob.js @@ -19,14 +19,14 @@ test('works with glob patterns', async (t) => { t.is( await read(path.join(output, 'a.css')), - await read('test/fixtures/glob/a.css') + await read('test/fixtures/glob/a.css'), ) t.is( await read(path.join(output, 'b.css')), - await read('test/fixtures/glob/b.css') + await read('test/fixtures/glob/b.css'), ) t.is( await read(path.join(output, 's.css')), - await read('test/fixtures/glob/s.css') + await read('test/fixtures/glob/s.css'), ) }) diff --git a/test/helpers/cli.js b/test/helpers/cli.js index 565d3ff..838d5a6 100644 --- a/test/helpers/cli.js +++ b/test/helpers/cli.js @@ -13,7 +13,7 @@ export default function (args, cwd) { stdout, stderr, }) - } + }, ) }) } diff --git a/test/helpers/read.js b/test/helpers/read.js index 1dbe451..e9939aa 100644 --- a/test/helpers/read.js +++ b/test/helpers/read.js @@ -2,6 +2,6 @@ import fs from 'fs-extra' export default function (path) { return fs.readFile(path, 'utf8').then( - (content) => content.replace(/\r\n/g, '\n') // normalize line endings on Windows + (content) => content.replace(/\r\n/g, '\n'), // normalize line endings on Windows ) } diff --git a/test/misc.js b/test/misc.js index 812b6d0..09bde3f 100644 --- a/test/misc.js +++ b/test/misc.js @@ -17,6 +17,6 @@ test('--version', async (t) => { t.truthy( version.stdout.length > 5, - 'expected --version to output version info' + 'expected --version to output version info', ) }) diff --git a/test/stdin.js b/test/stdin.js index 9fb0679..a682436 100644 --- a/test/stdin.js +++ b/test/stdin.js @@ -21,7 +21,7 @@ test.cb('reads from stdin', (t) => { t.end() }) .catch(t.end) - } + }, ) fs.createReadStream('test/fixtures/a.css').pipe(cp.stdin) diff --git a/test/stdout.js b/test/stdout.js index 68b6b4b..260180f 100644 --- a/test/stdout.js +++ b/test/stdout.js @@ -9,7 +9,7 @@ import read from './helpers/read.js' test.cb('writes to stdout', (t) => { const cp = exec( `node ${path.resolve( - 'index.js' + 'index.js', )} --parser sugarss -u postcss-import --no-map`, (error, stdout, stderr) => { if (error) t.end(error, stderr) @@ -20,7 +20,7 @@ test.cb('writes to stdout', (t) => { t.end() }) .catch(t.end) - } + }, ) fs.createReadStream('./test/fixtures/a.sss').pipe(cp.stdin) diff --git a/test/watch.js b/test/watch.js index 625df1b..357174a 100644 --- a/test/watch.js +++ b/test/watch.js @@ -52,7 +52,7 @@ testCb('--watch works', (t) => { // Using exec() and quoting "*.css" to test watch's glob handling: cp = exec( `node ${path.resolve('index.js')} "*.css" -o output.css --no-map -w`, - { cwd: dir } + { cwd: dir }, ) cp.on('error', t.end) cp.on('exit', (code) => { @@ -63,7 +63,7 @@ testCb('--watch works', (t) => { // Helper functions: function isEqual(p, expected) { return Promise.all([read(path.join(dir, p)), read(expected)]).then( - ([a, e]) => t.is(a, e) + ([a, e]) => t.is(a, e), ) } @@ -116,9 +116,9 @@ testCb('--watch dependencies', (t) => { watcher.on('ready', () => { cp = exec( `node ${path.resolve( - 'index.js' + 'index.js', )} import.css -o output.css -u postcss-import -w --no-map`, - { cwd: dir } + { cwd: dir }, ) cp.on('error', t.end) @@ -130,7 +130,7 @@ testCb('--watch dependencies', (t) => { // Helper functions: function isEqual(p, expected) { return Promise.all([read(path.join(dir, p)), read(expected)]).then( - ([a, e]) => t.is(a, e) + ([a, e]) => t.is(a, e), ) } @@ -168,9 +168,9 @@ testCb('--watch dependencies', (t) => { let killed = false const cp = exec( `node ${path.resolve( - 'index.js' + 'index.js', )} a.css -o output.css -u postcss-import -w --no-map`, - { cwd: dir } + { cwd: dir }, ) cp.on('error', t.end) cp.stderr.on('data', (chunk) => { @@ -197,7 +197,7 @@ testCb('--watch dependencies', (t) => { } }) .catch(t.end) - } + }, ) testCb('--watch does exit on closing stdin (Ctrl-D/EOF)', (t) => { @@ -246,7 +246,7 @@ testCb('--watch watches dependencies', (t) => { } ] } - ` + `, ) .then(() => { // Init watcher: @@ -281,9 +281,9 @@ testCb('--watch watches dependencies', (t) => { // Using exec() and quoting "*.css" to test watch's glob handling: cp = exec( `node ${path.resolve( - 'index.js' + 'index.js', )} "s.css" -o output.css --no-map -w`, - { cwd: dir } + { cwd: dir }, ) cp.on('error', t.end) cp.on('exit', (code) => { @@ -294,7 +294,7 @@ testCb('--watch watches dependencies', (t) => { // Helper functions: function isEqual(p, expected) { return Promise.all([read(path.join(dir, p)), read(expected)]).then( - ([a, e]) => t.is(a, e) + ([a, e]) => t.is(a, e), ) } @@ -333,13 +333,13 @@ testCb('--watch watches directory dependencies', (t) => { root.nodes = [] root.append(fs.readFileSync('${path.resolve( dir, - 'base/level-1/level-2/a.css' + 'base/level-1/level-2/a.css', )}', 'utf8')) return root } ] } - ` + `, ) .then(() => { // Init watcher: @@ -358,8 +358,8 @@ testCb('--watch watches directory dependencies', (t) => { .then((css) => fs.writeFile( path.join(dir, 'base/level-1/level-2/a.css'), - css - ) + css, + ), ) .catch(done) } @@ -379,9 +379,9 @@ testCb('--watch watches directory dependencies', (t) => { // Using exec() and quoting "*.css" to test watch's glob handling: cp = exec( `node ${path.resolve( - 'index.js' + 'index.js', )} "s.css" -o output.css --no-map -w`, - { cwd: dir } + { cwd: dir }, ) cp.on('error', t.end) cp.on('exit', (code) => { @@ -392,7 +392,7 @@ testCb('--watch watches directory dependencies', (t) => { // Helper functions: function isEqual(p, expected) { return Promise.all([read(path.join(dir, p)), read(expected)]).then( - ([a, e]) => t.is(a, e) + ([a, e]) => t.is(a, e), ) } @@ -405,7 +405,7 @@ testCb('--watch watches directory dependencies', (t) => { } }) .catch(t.end) - } + }, ) }) @@ -440,13 +440,13 @@ testCb( root.nodes = [] root.append(fs.readFileSync('${path.resolve( dir, - 'base/level-1/level-2/a.css' + 'base/level-1/level-2/a.css', )}', 'utf8')) return root } ] } - ` + `, ) .then(() => { // Init watcher: @@ -471,7 +471,7 @@ testCb( t.is( modifying, 'a.css', - `Unexpected change to ${p} after modifying ${modifying}` + `Unexpected change to ${p} after modifying ${modifying}`, ) done() } else if (p === 'base/level-1/level-2/unrelated.md') { @@ -484,9 +484,9 @@ testCb( watcher.on('ready', () => { cp = exec( `node ${path.resolve( - 'index.js' + 'index.js', )} "s.css" -o output.css --no-map -w`, - { cwd: dir } + { cwd: dir }, ) cp.on('error', t.end) cp.on('exit', (code) => { @@ -498,7 +498,7 @@ testCb( modifying = 'unrelated.md' fs.writeFile( path.join(dir, 'base/level-1/level-2/unrelated.md'), - 'Some modification' + 'Some modification', ).catch(done) } @@ -506,7 +506,7 @@ testCb( modifying = 'a.css' fs.writeFile( path.join(dir, 'base/level-1/level-2/a.css'), - 'a { color: hotpink }' + 'a { color: hotpink }', ).catch(done) } @@ -520,5 +520,5 @@ testCb( }) .catch(t.end) }) - } + }, )