diff --git a/docs/rules/no-array-callback-reference.md b/docs/rules/no-array-callback-reference.md index 6f7ba2c2c9..db62dbb37d 100644 --- a/docs/rules/no-array-callback-reference.md +++ b/docs/rules/no-array-callback-reference.md @@ -179,7 +179,7 @@ array.forEach(function (element) { ```js function readFile(filename) { - return fs.readFile(filename, 'utf8'); + return fs.readFile(filename, 'utf-8'); } Promise.map(filenames, readFile); diff --git a/docs/rules/prefer-json-parse-buffer.md b/docs/rules/prefer-json-parse-buffer.md index 112ff0018b..3a31599d04 100644 --- a/docs/rules/prefer-json-parse-buffer.md +++ b/docs/rules/prefer-json-parse-buffer.md @@ -14,11 +14,11 @@ Passing in a buffer may not be performant and is not compatible with TypeScript. ## Fail ```js -const packageJson = JSON.parse(await fs.readFile('./package.json', 'utf8')); +const packageJson = JSON.parse(await fs.readFile('./package.json', 'utf-8')); ``` ```js -const promise = fs.readFile('./package.json', {encoding: 'utf8'}); +const promise = fs.readFile('./package.json', {encoding: 'utf-8'}); const packageJson = JSON.parse(await promise); ``` @@ -29,7 +29,7 @@ const packageJson = JSON.parse(await fs.readFile('./package.json')); ``` ```js -const promise = fs.readFile('./package.json', {encoding: 'utf8', signal}); +const promise = fs.readFile('./package.json', {encoding: 'utf-8', signal}); const packageJson = JSON.parse(await promise); ``` diff --git a/docs/rules/prefer-module.md b/docs/rules/prefer-module.md index a90f2b9886..f110c4bbc4 100644 --- a/docs/rules/prefer-module.md +++ b/docs/rules/prefer-module.md @@ -85,7 +85,7 @@ const file = path.join(__dirname, 'foo.js'); ``` ```js -const content = fs.readFileSync(__filename, 'utf8'); +const content = fs.readFileSync(__filename, 'utf-8'); ``` ```js diff --git a/docs/rules/text-encoding-identifier-case.md b/docs/rules/text-encoding-identifier-case.md index 816b8893ad..e1b131ff74 100644 --- a/docs/rules/text-encoding-identifier-case.md +++ b/docs/rules/text-encoding-identifier-case.md @@ -7,7 +7,7 @@ -- Enforce `'utf8'` for [UTF-8](https://en.wikipedia.org/wiki/UTF-8) encoding. +- Enforce `'utf-8'` for [UTF-8](https://en.wikipedia.org/wiki/UTF-8) encoding. - Enforce `'ascii'` for [ASCII](https://en.wikipedia.org/wiki/ASCII) encoding. This rule only auto-fix encoding in `fs.readFile()` and `fs.readFileSync()`. @@ -23,13 +23,17 @@ await fs.readFile(file, 'ASCII'); ``` ```js -const string = buffer.toString('utf-8'); +const string = buffer.toString('utf8'); +``` + +```js +const string = buffer.toString('UTF8'); ``` ## Pass ```js -await fs.readFile(file, 'utf8'); +await fs.readFile(file, 'utf-8'); ``` ```js @@ -37,5 +41,5 @@ await fs.readFile(file, 'ascii'); ``` ```js -const string = buffer.toString('utf8'); +const string = buffer.toString('utf-8'); ``` diff --git a/rules/text-encoding-identifier-case.js b/rules/text-encoding-identifier-case.js index 32459a23fe..0f499e6518 100644 --- a/rules/text-encoding-identifier-case.js +++ b/rules/text-encoding-identifier-case.js @@ -10,9 +10,9 @@ const messages = { const getReplacement = encoding => { switch (encoding.toLowerCase()) { // eslint-disable-next-line unicorn/text-encoding-identifier-case - case 'utf-8': - case 'utf8': { - return 'utf8'; + case 'utf8': + case 'utf-8': { + return 'utf-8'; } case 'ascii': { @@ -41,21 +41,6 @@ const create = () => ({ return; } - if ( - // eslint-disable-next-line unicorn/text-encoding-identifier-case - node.value === 'utf-8' - && node.parent.type === 'JSXAttribute' - && node.parent.value === node - && node.parent.name.type === 'JSXIdentifier' - && node.parent.name.name.toLowerCase() === 'charset' - && node.parent.parent.type === 'JSXOpeningElement' - && node.parent.parent.attributes.includes(node.parent) - && node.parent.parent.name.type === 'JSXIdentifier' - && node.parent.parent.name.name.toLowerCase() === 'meta' - ) { - return; - } - const {raw} = node; const value = raw.slice(1, -1); diff --git a/scripts/create-rule.js b/scripts/create-rule.js index 3ec6a4aba3..8857bc23ba 100644 --- a/scripts/create-rule.js +++ b/scripts/create-rule.js @@ -29,7 +29,7 @@ function checkFiles(ruleId) { function renderTemplate({source, target, data}) { const templateFile = path.join(dirname, `template/${source}`); const targetFile = path.join(ROOT, target); - const templateContent = fs.readFileSync(templateFile, 'utf8'); + const templateContent = fs.readFileSync(templateFile, 'utf-8'); const compiled = template(templateContent); const content = compiled(data); diff --git a/scripts/rename-rule.js b/scripts/rename-rule.js index c25d3caad2..91df055648 100644 --- a/scripts/rename-rule.js +++ b/scripts/rename-rule.js @@ -52,7 +52,7 @@ async function renameRule(from, to) { } // eslint-disable-next-line no-await-in-loop - let text = await fsAsync.readFile(file, 'utf8'); + let text = await fsAsync.readFile(file, 'utf-8'); text = text.replaceAll(from, to); // eslint-disable-next-line no-await-in-loop await fsAsync.writeFile(file, text); diff --git a/test/integration/run-eslint.js b/test/integration/run-eslint.js index 96c11ea755..7368f4ece1 100644 --- a/test/integration/run-eslint.js +++ b/test/integration/run-eslint.js @@ -109,7 +109,7 @@ function getBabelParserConfig(project) { async function runEslint(project) { const eslintIgnoreFile = path.join(project.location, '.eslintignore'); const ignore = fs.existsSync(eslintIgnoreFile) - ? fs.readFileSync(eslintIgnoreFile, 'utf8').split('\n').filter(line => line && !line.startsWith('#')) + ? fs.readFileSync(eslintIgnoreFile, 'utf-8').split('\n').filter(line => line && !line.startsWith('#')) : []; const eslint = new ESLint({ diff --git a/test/integration/test.js b/test/integration/test.js index 938a540c50..224cd726ca 100644 --- a/test/integration/test.js +++ b/test/integration/test.js @@ -15,7 +15,7 @@ import runEslint from './run-eslint.js'; if (isCI) { const CI_CONFIG_FILE = new URL('../../.github/workflows/main.yml', import.meta.url); - const content = fs.readFileSync(CI_CONFIG_FILE, 'utf8'); + const content = fs.readFileSync(CI_CONFIG_FILE, 'utf-8'); const config = YAML.parse(content).jobs.integration.strategy.matrix.group; const expected = [...new Set(allProjects.map(project => String(project.group + 1)))]; diff --git a/test/package.js b/test/package.js index 4b2a777770..b93bcc1e07 100644 --- a/test/package.js +++ b/test/package.js @@ -108,7 +108,7 @@ test('Every rule has valid meta.type', t => { }); test('Every deprecated rules listed in docs/deprecated-rules.md', async t => { - const content = await fsAsync.readFile('docs/deprecated-rules.md', 'utf8'); + const content = await fsAsync.readFile('docs/deprecated-rules.md', 'utf-8'); const rulesInMarkdown = new Set(content.match(/(?<=^## ).*?$/gm)); for (const name of deprecatedRules) { @@ -125,7 +125,7 @@ test('Every rule file has the appropriate contents', t => { for (const ruleFile of ruleFiles) { const ruleName = path.basename(ruleFile, '.js'); const rulePath = path.join('rules', `${ruleName}.js`); - const ruleContents = fs.readFileSync(rulePath, 'utf8'); + const ruleContents = fs.readFileSync(rulePath, 'utf-8'); t.true(ruleContents.includes('/** @type {import(\'eslint\').Rule.RuleModule} */'), `${ruleName} includes jsdoc comment for rule type`); } @@ -140,7 +140,7 @@ test('Every rule has a doc with the appropriate content', t => { } /// const documentPath = path.join('docs/rules', `${ruleName}.md`); - /// const documentContents = fs.readFileSync(documentPath, 'utf8'); + /// const documentContents = fs.readFileSync(documentPath, 'utf-8'); // TODO: Disabled until https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2530 is done. // Check for examples. diff --git a/test/snapshots/better-regex.js.snap b/test/snapshots/better-regex.js.snap index e32f41d100..0f879a5427 100644 Binary files a/test/snapshots/better-regex.js.snap and b/test/snapshots/better-regex.js.snap differ diff --git a/test/snapshots/consistent-assert.js.snap b/test/snapshots/consistent-assert.js.snap index 63fd773eb1..098e443a3f 100644 Binary files a/test/snapshots/consistent-assert.js.snap and b/test/snapshots/consistent-assert.js.snap differ diff --git a/test/snapshots/consistent-date-clone.js.snap b/test/snapshots/consistent-date-clone.js.snap index 6cc27abc9b..bea9fe0b01 100644 Binary files a/test/snapshots/consistent-date-clone.js.snap and b/test/snapshots/consistent-date-clone.js.snap differ diff --git a/test/snapshots/consistent-empty-array-spread.js.snap b/test/snapshots/consistent-empty-array-spread.js.snap index c4ad96bdf1..ce514124ff 100644 Binary files a/test/snapshots/consistent-empty-array-spread.js.snap and b/test/snapshots/consistent-empty-array-spread.js.snap differ diff --git a/test/snapshots/consistent-existence-index-check.js.snap b/test/snapshots/consistent-existence-index-check.js.snap index 7275469ad0..3608288b4c 100644 Binary files a/test/snapshots/consistent-existence-index-check.js.snap and b/test/snapshots/consistent-existence-index-check.js.snap differ diff --git a/test/snapshots/consistent-function-scoping.js.snap b/test/snapshots/consistent-function-scoping.js.snap index ad8491164d..ff818aac8b 100644 Binary files a/test/snapshots/consistent-function-scoping.js.snap and b/test/snapshots/consistent-function-scoping.js.snap differ diff --git a/test/snapshots/empty-brace-spaces.js.snap b/test/snapshots/empty-brace-spaces.js.snap index 254c43ba9d..c98a592c87 100644 Binary files a/test/snapshots/empty-brace-spaces.js.snap and b/test/snapshots/empty-brace-spaces.js.snap differ diff --git a/test/snapshots/error-message.js.snap b/test/snapshots/error-message.js.snap index 0345896652..b980966c3d 100644 Binary files a/test/snapshots/error-message.js.snap and b/test/snapshots/error-message.js.snap differ diff --git a/test/snapshots/explicit-length-check.js.snap b/test/snapshots/explicit-length-check.js.snap index 6c3c848c74..4fd20ddc00 100644 Binary files a/test/snapshots/explicit-length-check.js.snap and b/test/snapshots/explicit-length-check.js.snap differ diff --git a/test/snapshots/filename-case.js.snap b/test/snapshots/filename-case.js.snap index f2c766bdb1..6809a3955c 100644 Binary files a/test/snapshots/filename-case.js.snap and b/test/snapshots/filename-case.js.snap differ diff --git a/test/snapshots/import-style.js.snap b/test/snapshots/import-style.js.snap index 85a935ced4..098f5771b4 100644 Binary files a/test/snapshots/import-style.js.snap and b/test/snapshots/import-style.js.snap differ diff --git a/test/snapshots/new-for-builtins.js.snap b/test/snapshots/new-for-builtins.js.snap index 65ffa5a6ba..783cb236a3 100644 Binary files a/test/snapshots/new-for-builtins.js.snap and b/test/snapshots/new-for-builtins.js.snap differ diff --git a/test/snapshots/no-abusive-eslint-disable.js.snap b/test/snapshots/no-abusive-eslint-disable.js.snap index 85c5254a03..4341156e89 100644 Binary files a/test/snapshots/no-abusive-eslint-disable.js.snap and b/test/snapshots/no-abusive-eslint-disable.js.snap differ diff --git a/test/snapshots/no-accessor-recursion.js.snap b/test/snapshots/no-accessor-recursion.js.snap index 19f335f53e..b54348658a 100644 Binary files a/test/snapshots/no-accessor-recursion.js.snap and b/test/snapshots/no-accessor-recursion.js.snap differ diff --git a/test/snapshots/no-anonymous-default-export.js.snap b/test/snapshots/no-anonymous-default-export.js.snap index 86dcd70aca..ae26bc35f2 100644 Binary files a/test/snapshots/no-anonymous-default-export.js.snap and b/test/snapshots/no-anonymous-default-export.js.snap differ diff --git a/test/snapshots/no-array-callback-reference.js.snap b/test/snapshots/no-array-callback-reference.js.snap index 10bf00d864..d49f12d5c1 100644 Binary files a/test/snapshots/no-array-callback-reference.js.snap and b/test/snapshots/no-array-callback-reference.js.snap differ diff --git a/test/snapshots/no-array-for-each.js.snap b/test/snapshots/no-array-for-each.js.snap index 13dc2309ba..dcedfdba27 100644 Binary files a/test/snapshots/no-array-for-each.js.snap and b/test/snapshots/no-array-for-each.js.snap differ diff --git a/test/snapshots/no-array-method-this-argument.js.snap b/test/snapshots/no-array-method-this-argument.js.snap index 4ea59be7bc..7de251dafa 100644 Binary files a/test/snapshots/no-array-method-this-argument.js.snap and b/test/snapshots/no-array-method-this-argument.js.snap differ diff --git a/test/snapshots/no-array-push-push.js.snap b/test/snapshots/no-array-push-push.js.snap index 4354945dcf..cf7e363c99 100644 Binary files a/test/snapshots/no-array-push-push.js.snap and b/test/snapshots/no-array-push-push.js.snap differ diff --git a/test/snapshots/no-await-expression-member.js.snap b/test/snapshots/no-await-expression-member.js.snap index eeaaa596fa..6e257b8c42 100644 Binary files a/test/snapshots/no-await-expression-member.js.snap and b/test/snapshots/no-await-expression-member.js.snap differ diff --git a/test/snapshots/no-await-in-promise-methods.js.snap b/test/snapshots/no-await-in-promise-methods.js.snap index 86985f2171..5b6e316a34 100644 Binary files a/test/snapshots/no-await-in-promise-methods.js.snap and b/test/snapshots/no-await-in-promise-methods.js.snap differ diff --git a/test/snapshots/no-console-spaces.js.snap b/test/snapshots/no-console-spaces.js.snap index cc56ad34cc..674fc61dbc 100644 Binary files a/test/snapshots/no-console-spaces.js.snap and b/test/snapshots/no-console-spaces.js.snap differ diff --git a/test/snapshots/no-document-cookie.js.snap b/test/snapshots/no-document-cookie.js.snap index 5ee4781021..877e40040f 100644 Binary files a/test/snapshots/no-document-cookie.js.snap and b/test/snapshots/no-document-cookie.js.snap differ diff --git a/test/snapshots/no-empty-file.js.snap b/test/snapshots/no-empty-file.js.snap index 9e43c5989d..1a7294faaf 100644 Binary files a/test/snapshots/no-empty-file.js.snap and b/test/snapshots/no-empty-file.js.snap differ diff --git a/test/snapshots/no-for-loop.js.snap b/test/snapshots/no-for-loop.js.snap index 16dc4cc8ef..3450d13069 100644 Binary files a/test/snapshots/no-for-loop.js.snap and b/test/snapshots/no-for-loop.js.snap differ diff --git a/test/snapshots/no-hex-escape.js.snap b/test/snapshots/no-hex-escape.js.snap index b8021570d5..5179447d97 100644 Binary files a/test/snapshots/no-hex-escape.js.snap and b/test/snapshots/no-hex-escape.js.snap differ diff --git a/test/snapshots/no-instanceof-builtins.js.snap b/test/snapshots/no-instanceof-builtins.js.snap index b719aab735..570b25d67f 100644 Binary files a/test/snapshots/no-instanceof-builtins.js.snap and b/test/snapshots/no-instanceof-builtins.js.snap differ diff --git a/test/snapshots/no-invalid-fetch-options.js.snap b/test/snapshots/no-invalid-fetch-options.js.snap index a41b2288ea..4b4e481e24 100644 Binary files a/test/snapshots/no-invalid-fetch-options.js.snap and b/test/snapshots/no-invalid-fetch-options.js.snap differ diff --git a/test/snapshots/no-invalid-remove-event-listener.js.snap b/test/snapshots/no-invalid-remove-event-listener.js.snap index 624e532867..cf7ff99b0a 100644 Binary files a/test/snapshots/no-invalid-remove-event-listener.js.snap and b/test/snapshots/no-invalid-remove-event-listener.js.snap differ diff --git a/test/snapshots/no-length-as-slice-end.js.snap b/test/snapshots/no-length-as-slice-end.js.snap index 3c10622615..852b0919da 100644 Binary files a/test/snapshots/no-length-as-slice-end.js.snap and b/test/snapshots/no-length-as-slice-end.js.snap differ diff --git a/test/snapshots/no-lonely-if.js.snap b/test/snapshots/no-lonely-if.js.snap index 909013198d..9b7b67207e 100644 Binary files a/test/snapshots/no-lonely-if.js.snap and b/test/snapshots/no-lonely-if.js.snap differ diff --git a/test/snapshots/no-magic-array-flat-depth.js.snap b/test/snapshots/no-magic-array-flat-depth.js.snap index 1b9af08994..76fcc43f86 100644 Binary files a/test/snapshots/no-magic-array-flat-depth.js.snap and b/test/snapshots/no-magic-array-flat-depth.js.snap differ diff --git a/test/snapshots/no-named-default.js.snap b/test/snapshots/no-named-default.js.snap index 0cd1c8a69e..fdcb439fdb 100644 Binary files a/test/snapshots/no-named-default.js.snap and b/test/snapshots/no-named-default.js.snap differ diff --git a/test/snapshots/no-negated-condition.js.snap b/test/snapshots/no-negated-condition.js.snap index 3307fc2a6b..5c48b29c27 100644 Binary files a/test/snapshots/no-negated-condition.js.snap and b/test/snapshots/no-negated-condition.js.snap differ diff --git a/test/snapshots/no-negation-in-equality-check.js.snap b/test/snapshots/no-negation-in-equality-check.js.snap index 983ecb0b3d..717874a5db 100644 Binary files a/test/snapshots/no-negation-in-equality-check.js.snap and b/test/snapshots/no-negation-in-equality-check.js.snap differ diff --git a/test/snapshots/no-nested-ternary.js.snap b/test/snapshots/no-nested-ternary.js.snap index fd1daf5af7..54dbdda511 100644 Binary files a/test/snapshots/no-nested-ternary.js.snap and b/test/snapshots/no-nested-ternary.js.snap differ diff --git a/test/snapshots/no-new-array.js.snap b/test/snapshots/no-new-array.js.snap index 7fd94ec29f..5a7f482752 100644 Binary files a/test/snapshots/no-new-array.js.snap and b/test/snapshots/no-new-array.js.snap differ diff --git a/test/snapshots/no-new-buffer.js.snap b/test/snapshots/no-new-buffer.js.snap index 9d078ca03f..d62ec1d42a 100644 Binary files a/test/snapshots/no-new-buffer.js.snap and b/test/snapshots/no-new-buffer.js.snap differ diff --git a/test/snapshots/no-null.js.snap b/test/snapshots/no-null.js.snap index 0261e2984a..a9458e2ec8 100644 Binary files a/test/snapshots/no-null.js.snap and b/test/snapshots/no-null.js.snap differ diff --git a/test/snapshots/no-object-as-default-parameter.js.snap b/test/snapshots/no-object-as-default-parameter.js.snap index 3485ec1e3c..cebf7e80dd 100644 Binary files a/test/snapshots/no-object-as-default-parameter.js.snap and b/test/snapshots/no-object-as-default-parameter.js.snap differ diff --git a/test/snapshots/no-process-exit.js.snap b/test/snapshots/no-process-exit.js.snap index 2026208201..a836a5aec1 100644 Binary files a/test/snapshots/no-process-exit.js.snap and b/test/snapshots/no-process-exit.js.snap differ diff --git a/test/snapshots/no-single-promise-in-promise-methods.js.snap b/test/snapshots/no-single-promise-in-promise-methods.js.snap index 98c46b487a..84ddd0d0be 100644 Binary files a/test/snapshots/no-single-promise-in-promise-methods.js.snap and b/test/snapshots/no-single-promise-in-promise-methods.js.snap differ diff --git a/test/snapshots/no-static-only-class.js.snap b/test/snapshots/no-static-only-class.js.snap index 92fc86ffec..ec97e19168 100644 Binary files a/test/snapshots/no-static-only-class.js.snap and b/test/snapshots/no-static-only-class.js.snap differ diff --git a/test/snapshots/no-thenable.js.snap b/test/snapshots/no-thenable.js.snap index 34f53757fc..54fa0e6546 100644 Binary files a/test/snapshots/no-thenable.js.snap and b/test/snapshots/no-thenable.js.snap differ diff --git a/test/snapshots/no-this-assignment.js.snap b/test/snapshots/no-this-assignment.js.snap index 2df090f01a..cbb61e65c1 100644 Binary files a/test/snapshots/no-this-assignment.js.snap and b/test/snapshots/no-this-assignment.js.snap differ diff --git a/test/snapshots/no-typeof-undefined.js.snap b/test/snapshots/no-typeof-undefined.js.snap index 8dad76954c..e7e7b8625e 100644 Binary files a/test/snapshots/no-typeof-undefined.js.snap and b/test/snapshots/no-typeof-undefined.js.snap differ diff --git a/test/snapshots/no-unnecessary-await.js.snap b/test/snapshots/no-unnecessary-await.js.snap index c6478a7d89..72e17fb107 100644 Binary files a/test/snapshots/no-unnecessary-await.js.snap and b/test/snapshots/no-unnecessary-await.js.snap differ diff --git a/test/snapshots/no-unreadable-array-destructuring.js.snap b/test/snapshots/no-unreadable-array-destructuring.js.snap index dc45eea16c..feb3b1ba46 100644 Binary files a/test/snapshots/no-unreadable-array-destructuring.js.snap and b/test/snapshots/no-unreadable-array-destructuring.js.snap differ diff --git a/test/snapshots/no-unreadable-iife.js.snap b/test/snapshots/no-unreadable-iife.js.snap index b58c53a964..c134e34dd8 100644 Binary files a/test/snapshots/no-unreadable-iife.js.snap and b/test/snapshots/no-unreadable-iife.js.snap differ diff --git a/test/snapshots/no-unused-properties.js.snap b/test/snapshots/no-unused-properties.js.snap index 9b6c4b1185..fb6697bb54 100644 Binary files a/test/snapshots/no-unused-properties.js.snap and b/test/snapshots/no-unused-properties.js.snap differ diff --git a/test/snapshots/no-useless-fallback-in-spread.js.snap b/test/snapshots/no-useless-fallback-in-spread.js.snap index 70cb3ce24c..94087217dc 100644 Binary files a/test/snapshots/no-useless-fallback-in-spread.js.snap and b/test/snapshots/no-useless-fallback-in-spread.js.snap differ diff --git a/test/snapshots/no-useless-length-check.js.snap b/test/snapshots/no-useless-length-check.js.snap index dfdfc26ca5..6f5ffdf277 100644 Binary files a/test/snapshots/no-useless-length-check.js.snap and b/test/snapshots/no-useless-length-check.js.snap differ diff --git a/test/snapshots/no-useless-spread.js.snap b/test/snapshots/no-useless-spread.js.snap index bf0428804b..4d952c21d0 100644 Binary files a/test/snapshots/no-useless-spread.js.snap and b/test/snapshots/no-useless-spread.js.snap differ diff --git a/test/snapshots/no-useless-switch-case.js.snap b/test/snapshots/no-useless-switch-case.js.snap index 24ca953312..37152508e3 100644 Binary files a/test/snapshots/no-useless-switch-case.js.snap and b/test/snapshots/no-useless-switch-case.js.snap differ diff --git a/test/snapshots/no-useless-undefined.js.snap b/test/snapshots/no-useless-undefined.js.snap index b40c88bb2f..c97e66a582 100644 Binary files a/test/snapshots/no-useless-undefined.js.snap and b/test/snapshots/no-useless-undefined.js.snap differ diff --git a/test/snapshots/no-zero-fractions.js.snap b/test/snapshots/no-zero-fractions.js.snap index 5d690e7a80..5b0e19cc96 100644 Binary files a/test/snapshots/no-zero-fractions.js.snap and b/test/snapshots/no-zero-fractions.js.snap differ diff --git a/test/snapshots/number-literal-case.js.snap b/test/snapshots/number-literal-case.js.snap index 35ee24dd38..ec4226b2bd 100644 Binary files a/test/snapshots/number-literal-case.js.snap and b/test/snapshots/number-literal-case.js.snap differ diff --git a/test/snapshots/numeric-separators-style.js.snap b/test/snapshots/numeric-separators-style.js.snap index 9ab6060435..871d918cf8 100644 Binary files a/test/snapshots/numeric-separators-style.js.snap and b/test/snapshots/numeric-separators-style.js.snap differ diff --git a/test/snapshots/prefer-add-event-listener.js.snap b/test/snapshots/prefer-add-event-listener.js.snap index 5ce6dffdb9..5c5bbbbf39 100644 Binary files a/test/snapshots/prefer-add-event-listener.js.snap and b/test/snapshots/prefer-add-event-listener.js.snap differ diff --git a/test/snapshots/prefer-array-flat-map.js.snap b/test/snapshots/prefer-array-flat-map.js.snap index 135918520c..fbf03cb43e 100644 Binary files a/test/snapshots/prefer-array-flat-map.js.snap and b/test/snapshots/prefer-array-flat-map.js.snap differ diff --git a/test/snapshots/prefer-array-flat.js.snap b/test/snapshots/prefer-array-flat.js.snap index 2de1bd8fcf..b035210018 100644 Binary files a/test/snapshots/prefer-array-flat.js.snap and b/test/snapshots/prefer-array-flat.js.snap differ diff --git a/test/snapshots/prefer-array-index-of.js.snap b/test/snapshots/prefer-array-index-of.js.snap index f5c8d58602..5137c9803d 100644 Binary files a/test/snapshots/prefer-array-index-of.js.snap and b/test/snapshots/prefer-array-index-of.js.snap differ diff --git a/test/snapshots/prefer-array-some.js.snap b/test/snapshots/prefer-array-some.js.snap index a7086be00a..2b5b23d15b 100644 Binary files a/test/snapshots/prefer-array-some.js.snap and b/test/snapshots/prefer-array-some.js.snap differ diff --git a/test/snapshots/prefer-at.js.snap b/test/snapshots/prefer-at.js.snap index ae6e57d547..7ac9b7366c 100644 Binary files a/test/snapshots/prefer-at.js.snap and b/test/snapshots/prefer-at.js.snap differ diff --git a/test/snapshots/prefer-blob-reading-methods.js.snap b/test/snapshots/prefer-blob-reading-methods.js.snap index b9e89e1746..3dbca6bae8 100644 Binary files a/test/snapshots/prefer-blob-reading-methods.js.snap and b/test/snapshots/prefer-blob-reading-methods.js.snap differ diff --git a/test/snapshots/prefer-code-point.js.snap b/test/snapshots/prefer-code-point.js.snap index abce402146..f747de02e9 100644 Binary files a/test/snapshots/prefer-code-point.js.snap and b/test/snapshots/prefer-code-point.js.snap differ diff --git a/test/snapshots/prefer-date-now.js.snap b/test/snapshots/prefer-date-now.js.snap index 0084af7264..f9e7b25cbd 100644 Binary files a/test/snapshots/prefer-date-now.js.snap and b/test/snapshots/prefer-date-now.js.snap differ diff --git a/test/snapshots/prefer-dom-node-dataset.js.snap b/test/snapshots/prefer-dom-node-dataset.js.snap index 955a0d3607..5560787054 100644 Binary files a/test/snapshots/prefer-dom-node-dataset.js.snap and b/test/snapshots/prefer-dom-node-dataset.js.snap differ diff --git a/test/snapshots/prefer-dom-node-remove.js.snap b/test/snapshots/prefer-dom-node-remove.js.snap index d4a3697ff8..d04878f9a4 100644 Binary files a/test/snapshots/prefer-dom-node-remove.js.snap and b/test/snapshots/prefer-dom-node-remove.js.snap differ diff --git a/test/snapshots/prefer-dom-node-text-content.js.snap b/test/snapshots/prefer-dom-node-text-content.js.snap index 2faedc8009..af2f7093c0 100644 Binary files a/test/snapshots/prefer-dom-node-text-content.js.snap and b/test/snapshots/prefer-dom-node-text-content.js.snap differ diff --git a/test/snapshots/prefer-event-target.js.snap b/test/snapshots/prefer-event-target.js.snap index 30cf2c8c2d..abfccd4ece 100644 Binary files a/test/snapshots/prefer-event-target.js.snap and b/test/snapshots/prefer-event-target.js.snap differ diff --git a/test/snapshots/prefer-export-from.js.snap b/test/snapshots/prefer-export-from.js.snap index 9e9b1ac487..6590e7cdee 100644 Binary files a/test/snapshots/prefer-export-from.js.snap and b/test/snapshots/prefer-export-from.js.snap differ diff --git a/test/snapshots/prefer-global-this.js.snap b/test/snapshots/prefer-global-this.js.snap index 82b1cb5b9c..ac26b213b0 100644 Binary files a/test/snapshots/prefer-global-this.js.snap and b/test/snapshots/prefer-global-this.js.snap differ diff --git a/test/snapshots/prefer-includes.js.snap b/test/snapshots/prefer-includes.js.snap index 788a89c992..c18b0afa40 100644 Binary files a/test/snapshots/prefer-includes.js.snap and b/test/snapshots/prefer-includes.js.snap differ diff --git a/test/snapshots/prefer-json-parse-buffer.js.snap b/test/snapshots/prefer-json-parse-buffer.js.snap index a2af0e0d35..26554c36c7 100644 Binary files a/test/snapshots/prefer-json-parse-buffer.js.snap and b/test/snapshots/prefer-json-parse-buffer.js.snap differ diff --git a/test/snapshots/prefer-keyboard-event-key.js.snap b/test/snapshots/prefer-keyboard-event-key.js.snap index 61d2cd8241..1ab741ed78 100644 Binary files a/test/snapshots/prefer-keyboard-event-key.js.snap and b/test/snapshots/prefer-keyboard-event-key.js.snap differ diff --git a/test/snapshots/prefer-logical-operator-over-ternary.js.snap b/test/snapshots/prefer-logical-operator-over-ternary.js.snap index 2a31df0faa..8760d12249 100644 Binary files a/test/snapshots/prefer-logical-operator-over-ternary.js.snap and b/test/snapshots/prefer-logical-operator-over-ternary.js.snap differ diff --git a/test/snapshots/prefer-math-min-max.js.snap b/test/snapshots/prefer-math-min-max.js.snap index 97e2d18737..9dc36754c8 100644 Binary files a/test/snapshots/prefer-math-min-max.js.snap and b/test/snapshots/prefer-math-min-max.js.snap differ diff --git a/test/snapshots/prefer-math-trunc.js.snap b/test/snapshots/prefer-math-trunc.js.snap index 8834cd0bba..a80a47291d 100644 Binary files a/test/snapshots/prefer-math-trunc.js.snap and b/test/snapshots/prefer-math-trunc.js.snap differ diff --git a/test/snapshots/prefer-modern-math-apis.js.snap b/test/snapshots/prefer-modern-math-apis.js.snap index 4d8331fe37..588050f5ff 100644 Binary files a/test/snapshots/prefer-modern-math-apis.js.snap and b/test/snapshots/prefer-modern-math-apis.js.snap differ diff --git a/test/snapshots/prefer-module.js.snap b/test/snapshots/prefer-module.js.snap index 062d9ab1a2..44f3df1ba7 100644 Binary files a/test/snapshots/prefer-module.js.snap and b/test/snapshots/prefer-module.js.snap differ diff --git a/test/snapshots/prefer-native-coercion-functions.js.snap b/test/snapshots/prefer-native-coercion-functions.js.snap index f73d00b9cc..31ddaedf12 100644 Binary files a/test/snapshots/prefer-native-coercion-functions.js.snap and b/test/snapshots/prefer-native-coercion-functions.js.snap differ diff --git a/test/snapshots/prefer-negative-index.js.snap b/test/snapshots/prefer-negative-index.js.snap index 7eb3bcab85..ced3e7dbd4 100644 Binary files a/test/snapshots/prefer-negative-index.js.snap and b/test/snapshots/prefer-negative-index.js.snap differ diff --git a/test/snapshots/prefer-node-protocol.js.snap b/test/snapshots/prefer-node-protocol.js.snap index 08e8c36ac4..9d302517b8 100644 Binary files a/test/snapshots/prefer-node-protocol.js.snap and b/test/snapshots/prefer-node-protocol.js.snap differ diff --git a/test/snapshots/prefer-number-properties.js.snap b/test/snapshots/prefer-number-properties.js.snap index ad2f7b6233..9f192e0185 100644 Binary files a/test/snapshots/prefer-number-properties.js.snap and b/test/snapshots/prefer-number-properties.js.snap differ diff --git a/test/snapshots/prefer-object-from-entries.js.snap b/test/snapshots/prefer-object-from-entries.js.snap index 5febd811db..1a0d5cf6f0 100644 Binary files a/test/snapshots/prefer-object-from-entries.js.snap and b/test/snapshots/prefer-object-from-entries.js.snap differ diff --git a/test/snapshots/prefer-optional-catch-binding.js.snap b/test/snapshots/prefer-optional-catch-binding.js.snap index 41584c0d64..a47cf0d3c9 100644 Binary files a/test/snapshots/prefer-optional-catch-binding.js.snap and b/test/snapshots/prefer-optional-catch-binding.js.snap differ diff --git a/test/snapshots/prefer-prototype-methods.js.snap b/test/snapshots/prefer-prototype-methods.js.snap index 3f1ec46922..4213261969 100644 Binary files a/test/snapshots/prefer-prototype-methods.js.snap and b/test/snapshots/prefer-prototype-methods.js.snap differ diff --git a/test/snapshots/prefer-query-selector.js.snap b/test/snapshots/prefer-query-selector.js.snap index fceed48957..5a85967e70 100644 Binary files a/test/snapshots/prefer-query-selector.js.snap and b/test/snapshots/prefer-query-selector.js.snap differ diff --git a/test/snapshots/prefer-regexp-test.js.snap b/test/snapshots/prefer-regexp-test.js.snap index 164bd973e8..4d6a346329 100644 Binary files a/test/snapshots/prefer-regexp-test.js.snap and b/test/snapshots/prefer-regexp-test.js.snap differ diff --git a/test/snapshots/prefer-set-has.js.snap b/test/snapshots/prefer-set-has.js.snap index da6c8c8af5..2f508e3314 100644 Binary files a/test/snapshots/prefer-set-has.js.snap and b/test/snapshots/prefer-set-has.js.snap differ diff --git a/test/snapshots/prefer-set-size.js.snap b/test/snapshots/prefer-set-size.js.snap index 76279b7288..ba1cd00f96 100644 Binary files a/test/snapshots/prefer-set-size.js.snap and b/test/snapshots/prefer-set-size.js.snap differ diff --git a/test/snapshots/prefer-spread.js.snap b/test/snapshots/prefer-spread.js.snap index 51b79f8dd2..7a017b9ce3 100644 Binary files a/test/snapshots/prefer-spread.js.snap and b/test/snapshots/prefer-spread.js.snap differ diff --git a/test/snapshots/prefer-string-raw.js.snap b/test/snapshots/prefer-string-raw.js.snap index 93f30083b5..053c9a6411 100644 Binary files a/test/snapshots/prefer-string-raw.js.snap and b/test/snapshots/prefer-string-raw.js.snap differ diff --git a/test/snapshots/prefer-string-replace-all.js.snap b/test/snapshots/prefer-string-replace-all.js.snap index ab9ccae832..6a205643a4 100644 Binary files a/test/snapshots/prefer-string-replace-all.js.snap and b/test/snapshots/prefer-string-replace-all.js.snap differ diff --git a/test/snapshots/prefer-string-slice.js.snap b/test/snapshots/prefer-string-slice.js.snap index 3097c23706..0b08289152 100644 Binary files a/test/snapshots/prefer-string-slice.js.snap and b/test/snapshots/prefer-string-slice.js.snap differ diff --git a/test/snapshots/prefer-string-starts-ends-with.js.snap b/test/snapshots/prefer-string-starts-ends-with.js.snap index 371f99d5d6..23199d3c3b 100644 Binary files a/test/snapshots/prefer-string-starts-ends-with.js.snap and b/test/snapshots/prefer-string-starts-ends-with.js.snap differ diff --git a/test/snapshots/prefer-string-trim-start-end.js.snap b/test/snapshots/prefer-string-trim-start-end.js.snap index 012120c6b4..1661a4c50f 100644 Binary files a/test/snapshots/prefer-string-trim-start-end.js.snap and b/test/snapshots/prefer-string-trim-start-end.js.snap differ diff --git a/test/snapshots/prefer-structured-clone.js.snap b/test/snapshots/prefer-structured-clone.js.snap index 5e3bfab094..db252e19f3 100644 Binary files a/test/snapshots/prefer-structured-clone.js.snap and b/test/snapshots/prefer-structured-clone.js.snap differ diff --git a/test/snapshots/prefer-switch.js.snap b/test/snapshots/prefer-switch.js.snap index d1c0898a1b..b6e5390625 100644 Binary files a/test/snapshots/prefer-switch.js.snap and b/test/snapshots/prefer-switch.js.snap differ diff --git a/test/snapshots/prefer-top-level-await.js.snap b/test/snapshots/prefer-top-level-await.js.snap index 52bd4f772e..ba32d9896e 100644 Binary files a/test/snapshots/prefer-top-level-await.js.snap and b/test/snapshots/prefer-top-level-await.js.snap differ diff --git a/test/snapshots/prefer-type-error.js.snap b/test/snapshots/prefer-type-error.js.snap index 5e591ce2bf..8005b9472a 100644 Binary files a/test/snapshots/prefer-type-error.js.snap and b/test/snapshots/prefer-type-error.js.snap differ diff --git a/test/snapshots/relative-url-style.js.snap b/test/snapshots/relative-url-style.js.snap index ff05d54e2a..42092139f1 100644 Binary files a/test/snapshots/relative-url-style.js.snap and b/test/snapshots/relative-url-style.js.snap differ diff --git a/test/snapshots/require-array-join-separator.js.snap b/test/snapshots/require-array-join-separator.js.snap index 1f5c0fe66d..ff22201b21 100644 Binary files a/test/snapshots/require-array-join-separator.js.snap and b/test/snapshots/require-array-join-separator.js.snap differ diff --git a/test/snapshots/require-number-to-fixed-digits-argument.js.snap b/test/snapshots/require-number-to-fixed-digits-argument.js.snap index ccb74a6904..c72e603417 100644 Binary files a/test/snapshots/require-number-to-fixed-digits-argument.js.snap and b/test/snapshots/require-number-to-fixed-digits-argument.js.snap differ diff --git a/test/snapshots/require-post-message-target-origin.js.snap b/test/snapshots/require-post-message-target-origin.js.snap index 0232e727cd..f2e4d286e0 100644 Binary files a/test/snapshots/require-post-message-target-origin.js.snap and b/test/snapshots/require-post-message-target-origin.js.snap differ diff --git a/test/snapshots/switch-case-braces.js.snap b/test/snapshots/switch-case-braces.js.snap index c7a3ce0cc9..9e06410372 100644 Binary files a/test/snapshots/switch-case-braces.js.snap and b/test/snapshots/switch-case-braces.js.snap differ diff --git a/test/snapshots/template-indent.js.snap b/test/snapshots/template-indent.js.snap index 5519cc4b88..ddf7aad1ce 100644 Binary files a/test/snapshots/template-indent.js.snap and b/test/snapshots/template-indent.js.snap differ diff --git a/test/snapshots/text-encoding-identifier-case.js.md b/test/snapshots/text-encoding-identifier-case.js.md index 4a7984e3fd..a9c02b9e93 100644 --- a/test/snapshots/text-encoding-identifier-case.js.md +++ b/test/snapshots/text-encoding-identifier-case.js.md @@ -16,52 +16,71 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | "UTF-8"␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | "utf8"␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | "utf-8"␊ ` -## invalid(2): "utf-8" +## invalid(2): "UTF8" > Input `␊ - 1 | "utf-8"␊ + 1 | "UTF8"␊ ` > Error 1/1 `␊ - > 1 | "utf-8"␊ - | ^^^^^^^ Prefer \`utf8\` over \`utf-8\`.␊ + > 1 | "UTF8"␊ + | ^^^^^^ Prefer \`utf-8\` over \`UTF8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`utf-8\` with \`utf8\`.␊ - 1 | "utf8"␊ + Suggestion 1/1: Replace \`UTF8\` with \`utf-8\`.␊ + 1 | "utf-8"␊ ` -## invalid(3): 'utf-8' +## invalid(3): "utf8" > Input `␊ - 1 | 'utf-8'␊ + 1 | "utf8"␊ ` > Error 1/1 `␊ - > 1 | 'utf-8'␊ - | ^^^^^^^ Prefer \`utf8\` over \`utf-8\`.␊ + > 1 | "utf8"␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`utf-8\` with \`utf8\`.␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | "utf-8"␊ + ` + +## invalid(4): 'utf8' + +> Input + + `␊ 1 | 'utf8'␊ ` -## invalid(4): "Utf8" +> Error 1/1 + + `␊ + > 1 | 'utf8'␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | 'utf-8'␊ + ` + +## invalid(5): "Utf8" > Input @@ -73,14 +92,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | "Utf8"␊ - | ^^^^^^ Prefer \`utf8\` over \`Utf8\`.␊ + | ^^^^^^ Prefer \`utf-8\` over \`Utf8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`Utf8\` with \`utf8\`.␊ - 1 | "utf8"␊ + Suggestion 1/1: Replace \`Utf8\` with \`utf-8\`.␊ + 1 | "utf-8"␊ ` -## invalid(5): "ASCII" +## invalid(6): "ASCII" > Input @@ -99,7 +118,7 @@ Generated by [AVA](https://avajs.dev). 1 | "ascii"␊ ` -## invalid(6): fs.readFile?.(file, "UTF-8") +## invalid(7): fs.readFile?.(file, "UTF-8") > Input @@ -111,14 +130,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | fs.readFile?.(file, "UTF-8")␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | fs.readFile?.(file, "utf8")␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | fs.readFile?.(file, "utf-8")␊ ` -## invalid(7): fs?.readFile(file, "UTF-8") +## invalid(8): fs?.readFile(file, "UTF-8") > Input @@ -130,14 +149,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | fs?.readFile(file, "UTF-8")␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | fs?.readFile(file, "utf8")␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | fs?.readFile(file, "utf-8")␊ ` -## invalid(8): readFile(file, "UTF-8") +## invalid(9): readFile(file, "UTF-8") > Input @@ -149,14 +168,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | readFile(file, "UTF-8")␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | readFile(file, "utf8")␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | readFile(file, "utf-8")␊ ` -## invalid(9): fs.readFile(...file, "UTF-8") +## invalid(10): fs.readFile(...file, "UTF-8") > Input @@ -168,14 +187,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | fs.readFile(...file, "UTF-8")␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | fs.readFile(...file, "utf8")␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | fs.readFile(...file, "utf-8")␊ ` -## invalid(10): new fs.readFile(file, "UTF-8") +## invalid(11): new fs.readFile(file, "UTF-8") > Input @@ -187,14 +206,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | new fs.readFile(file, "UTF-8")␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | new fs.readFile(file, "utf8")␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | new fs.readFile(file, "utf-8")␊ ` -## invalid(11): fs.readFile(file, {encoding: "UTF-8"}) +## invalid(12): fs.readFile(file, {encoding: "UTF-8"}) > Input @@ -206,14 +225,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | fs.readFile(file, {encoding: "UTF-8"})␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | fs.readFile(file, {encoding: "utf8"})␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | fs.readFile(file, {encoding: "utf-8"})␊ ` -## invalid(12): fs.readFile("UTF-8") +## invalid(13): fs.readFile("UTF-8") > Input @@ -225,14 +244,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | fs.readFile("UTF-8")␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | fs.readFile("utf8")␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | fs.readFile("utf-8")␊ ` -## invalid(13): fs.readFile(file, "UTF-8", () => {}) +## invalid(14): fs.readFile(file, "UTF-8", () => {}) > Input @@ -243,17 +262,17 @@ Generated by [AVA](https://avajs.dev). > Output `␊ - 1 | fs.readFile(file, "utf8", () => {})␊ + 1 | fs.readFile(file, "utf-8", () => {})␊ ` > Error 1/1 `␊ > 1 | fs.readFile(file, "UTF-8", () => {})␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ` -## invalid(14): fs.readFileSync(file, "UTF-8") +## invalid(15): fs.readFileSync(file, "UTF-8") > Input @@ -264,17 +283,17 @@ Generated by [AVA](https://avajs.dev). > Output `␊ - 1 | fs.readFileSync(file, "utf8")␊ + 1 | fs.readFileSync(file, "utf-8")␊ ` > Error 1/1 `␊ > 1 | fs.readFileSync(file, "UTF-8")␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ` -## invalid(15): fs[readFile](file, "UTF-8") +## invalid(16): fs[readFile](file, "UTF-8") > Input @@ -286,14 +305,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | fs[readFile](file, "UTF-8")␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | fs[readFile](file, "utf8")␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | fs[readFile](file, "utf-8")␊ ` -## invalid(16): fs["readFile"](file, "UTF-8") +## invalid(17): fs["readFile"](file, "UTF-8") > Input @@ -305,14 +324,14 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | fs["readFile"](file, "UTF-8")␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`UTF-8\` with \`utf8\`.␊ - 1 | fs["readFile"](file, "utf8")␊ + Suggestion 1/1: Replace \`UTF-8\` with \`utf-8\`.␊ + 1 | fs["readFile"](file, "utf-8")␊ ` -## invalid(17): await fs.readFile(file, "UTF-8",) +## invalid(18): await fs.readFile(file, "UTF-8",) > Input @@ -323,17 +342,17 @@ Generated by [AVA](https://avajs.dev). > Output `␊ - 1 | await fs.readFile(file, "utf8",)␊ + 1 | await fs.readFile(file, "utf-8",)␊ ` > Error 1/1 `␊ > 1 | await fs.readFile(file, "UTF-8",)␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ` -## invalid(18): fs.promises.readFile(file, "UTF-8",) +## invalid(19): fs.promises.readFile(file, "UTF-8",) > Input @@ -344,17 +363,17 @@ Generated by [AVA](https://avajs.dev). > Output `␊ - 1 | fs.promises.readFile(file, "utf8",)␊ + 1 | fs.promises.readFile(file, "utf-8",)␊ ` > Error 1/1 `␊ > 1 | fs.promises.readFile(file, "UTF-8",)␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ` -## invalid(19): whatever.readFile(file, "UTF-8",) +## invalid(20): whatever.readFile(file, "UTF-8",) > Input @@ -365,55 +384,369 @@ Generated by [AVA](https://avajs.dev). > Output `␊ - 1 | whatever.readFile(file, "utf8",)␊ + 1 | whatever.readFile(file, "utf-8",)␊ ` > Error 1/1 `␊ > 1 | whatever.readFile(file, "UTF-8",)␊ - | ^^^^^^^ Prefer \`utf8\` over \`UTF-8\`.␊ + | ^^^^^^^ Prefer \`utf-8\` over \`UTF-8\`.␊ ` -## invalid(1): +## invalid(21): fs.readFile?.(file, "utf8") > Input `␊ - 1 | ␊ + 1 | fs.readFile?.(file, "utf8")␊ ` > Error 1/1 `␊ - > 1 | ␊ - | ^^^^^^^ Prefer \`utf8\` over \`utf-8\`.␊ + > 1 | fs.readFile?.(file, "utf8")␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`utf-8\` with \`utf8\`.␊ - 1 | ␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | fs.readFile?.(file, "utf-8")␊ ` -## invalid(2): +## invalid(22): fs?.readFile(file, "utf8") > Input `␊ - 1 | ␊ + 1 | fs?.readFile(file, "utf8")␊ + ` + +> Error 1/1 + + `␊ + > 1 | fs?.readFile(file, "utf8")␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | fs?.readFile(file, "utf-8")␊ + ` + +## invalid(23): readFile(file, "utf8") + +> Input + + `␊ + 1 | readFile(file, "utf8")␊ + ` + +> Error 1/1 + + `␊ + > 1 | readFile(file, "utf8")␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | readFile(file, "utf-8")␊ + ` + +## invalid(24): fs.readFile(...file, "utf8") + +> Input + + `␊ + 1 | fs.readFile(...file, "utf8")␊ ` > Error 1/1 `␊ - > 1 | ␊ - | ^^^^^^^ Prefer \`utf8\` over \`utf-8\`.␊ + > 1 | fs.readFile(...file, "utf8")␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ ␊ --------------------------------------------------------------------------------␊ - Suggestion 1/1: Replace \`utf-8\` with \`utf8\`.␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | fs.readFile(...file, "utf-8")␊ + ` + +## invalid(25): new fs.readFile(file, "utf8") + +> Input + + `␊ + 1 | new fs.readFile(file, "utf8")␊ + ` + +> Error 1/1 + + `␊ + > 1 | new fs.readFile(file, "utf8")␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | new fs.readFile(file, "utf-8")␊ + ` + +## invalid(26): fs.readFile(file, {encoding: "utf8"}) + +> Input + + `␊ + 1 | fs.readFile(file, {encoding: "utf8"})␊ + ` + +> Error 1/1 + + `␊ + > 1 | fs.readFile(file, {encoding: "utf8"})␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | fs.readFile(file, {encoding: "utf-8"})␊ + ` + +## invalid(27): fs.readFile("utf8") + +> Input + + `␊ + 1 | fs.readFile("utf8")␊ + ` + +> Error 1/1 + + `␊ + > 1 | fs.readFile("utf8")␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | fs.readFile("utf-8")␊ + ` + +## invalid(28): fs.readFile(file, "utf8", () => {}) + +> Input + + `␊ + 1 | fs.readFile(file, "utf8", () => {})␊ + ` + +> Output + + `␊ + 1 | fs.readFile(file, "utf-8", () => {})␊ + ` + +> Error 1/1 + + `␊ + > 1 | fs.readFile(file, "utf8", () => {})␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ` + +## invalid(29): fs.readFileSync(file, "utf8") + +> Input + + `␊ + 1 | fs.readFileSync(file, "utf8")␊ + ` + +> Output + + `␊ + 1 | fs.readFileSync(file, "utf-8")␊ + ` + +> Error 1/1 + + `␊ + > 1 | fs.readFileSync(file, "utf8")␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ` + +## invalid(30): fs[readFile](file, "utf8") + +> Input + + `␊ + 1 | fs[readFile](file, "utf8")␊ + ` + +> Error 1/1 + + `␊ + > 1 | fs[readFile](file, "utf8")␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | fs[readFile](file, "utf-8")␊ + ` + +## invalid(31): fs["readFile"](file, "utf8") + +> Input + + `␊ + 1 | fs["readFile"](file, "utf8")␊ + ` + +> Error 1/1 + + `␊ + > 1 | fs["readFile"](file, "utf8")␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | fs["readFile"](file, "utf-8")␊ + ` + +## invalid(32): await fs.readFile(file, "utf8",) + +> Input + + `␊ + 1 | await fs.readFile(file, "utf8",)␊ + ` + +> Output + + `␊ + 1 | await fs.readFile(file, "utf-8",)␊ + ` + +> Error 1/1 + + `␊ + > 1 | await fs.readFile(file, "utf8",)␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ` + +## invalid(33): fs.promises.readFile(file, "utf8",) + +> Input + + `␊ + 1 | fs.promises.readFile(file, "utf8",)␊ + ` + +> Output + + `␊ + 1 | fs.promises.readFile(file, "utf-8",)␊ + ` + +> Error 1/1 + + `␊ + > 1 | fs.promises.readFile(file, "utf8",)␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ` + +## invalid(34): whatever.readFile(file, "utf8",) + +> Input + + `␊ + 1 | whatever.readFile(file, "utf8",)␊ + ` + +> Output + + `␊ + 1 | whatever.readFile(file, "utf-8",)␊ + ` + +> Error 1/1 + + `␊ + > 1 | whatever.readFile(file, "utf8",)␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ` + +## invalid(1): + +> Input + + `␊ + 1 | ␊ + ` + +> Error 1/1 + + `␊ + > 1 | ␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | ␊ + ` + +## invalid(2): + +> Input + + `␊ + 1 | ␊ + ` + +> Error 1/1 + + `␊ + > 1 | ␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | ␊ + ` + +## invalid(3): + +> Input + + `␊ + 1 | ␊ + ` + +> Error 1/1 + + `␊ + > 1 | ␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | ␊ + ` + +## invalid(4): + +> Input + + `␊ 1 | ␊ ` -## invalid(3): +> Error 1/1 + + `␊ + > 1 | ␊ + | ^^^^^^ Prefer \`utf-8\` over \`utf8\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Replace \`utf8\` with \`utf-8\`.␊ + 1 | ␊ + ` + +## invalid(5): > Input @@ -432,7 +765,7 @@ Generated by [AVA](https://avajs.dev). 1 | ␊ ` -## invalid(4): +## invalid(6): > Input diff --git a/test/snapshots/text-encoding-identifier-case.js.snap b/test/snapshots/text-encoding-identifier-case.js.snap index 0e93a762c2..ab3ca7eafe 100644 Binary files a/test/snapshots/text-encoding-identifier-case.js.snap and b/test/snapshots/text-encoding-identifier-case.js.snap differ diff --git a/test/snapshots/throw-new-error.js.snap b/test/snapshots/throw-new-error.js.snap index 84e6045ed9..78096a6836 100644 Binary files a/test/snapshots/throw-new-error.js.snap and b/test/snapshots/throw-new-error.js.snap differ diff --git a/test/text-encoding-identifier-case.js b/test/text-encoding-identifier-case.js index 2b0930d659..f320c6b4af 100644 --- a/test/text-encoding-identifier-case.js +++ b/test/text-encoding-identifier-case.js @@ -5,20 +5,22 @@ const {test} = getTester(import.meta); test.snapshot({ valid: [ '`UTF-8`', - '"utf8"', + '"utf-8"', '"utf+8"', '" utf8 "', - '\'utf8\'', + '\'utf-8\'', String.raw`"\u0055tf8"`, 'const ASCII = 1', 'const UTF8 = 1', ], invalid: [ '"UTF-8"', - '"utf-8"', - '\'utf-8\'', + '"UTF8"', + '"utf8"', + '\'utf8\'', '"Utf8"', '"ASCII"', + 'fs.readFile?.(file, "UTF-8")', 'fs?.readFile(file, "UTF-8")', 'readFile(file, "UTF-8")', @@ -33,6 +35,21 @@ test.snapshot({ 'await fs.readFile(file, "UTF-8",)', 'fs.promises.readFile(file, "UTF-8",)', 'whatever.readFile(file, "UTF-8",)', + + 'fs.readFile?.(file, "utf8")', + 'fs?.readFile(file, "utf8")', + 'readFile(file, "utf8")', + 'fs.readFile(...file, "utf8")', + 'new fs.readFile(file, "utf8")', + 'fs.readFile(file, {encoding: "utf8"})', + 'fs.readFile("utf8")', + 'fs.readFile(file, "utf8", () => {})', + 'fs.readFileSync(file, "utf8")', + 'fs[readFile](file, "utf8")', + 'fs["readFile"](file, "utf8")', + 'await fs.readFile(file, "utf8",)', + 'fs.promises.readFile(file, "utf8",)', + 'whatever.readFile(file, "utf8",)', ], }); @@ -52,8 +69,10 @@ test.snapshot({ '', ], invalid: [ - '', - '', + '', + '', + '', + '', '', '', ], diff --git a/test/unit/snapshots/assert-token.js.snap b/test/unit/snapshots/assert-token.js.snap index 976e4c3ab8..c4699f415e 100644 Binary files a/test/unit/snapshots/assert-token.js.snap and b/test/unit/snapshots/assert-token.js.snap differ