Skip to content

Commit

Permalink
Allow trailing commas in ESLint (#1013)
Browse files Browse the repository at this point in the history
* Update comma-dangle rule

* Fix dangling commas
  • Loading branch information
jamesmaa authored May 31, 2024
1 parent b3f5474 commit 76ca08b
Show file tree
Hide file tree
Showing 158 changed files with 3,021 additions and 3,021 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"@stylistic/arrow-spacing": ["error", {"before": true, "after": true}],
"@stylistic/block-spacing": ["error", "always"],
"@stylistic/brace-style": ["error", "1tbs", {"allowSingleLine": true}],
"@stylistic/comma-dangle": ["error", "never"],
"@stylistic/comma-dangle": ["error", "always-multiline"],
"@stylistic/comma-spacing": ["error", {"before": false, "after": true}],
"@stylistic/comma-style": ["error", "last"],
"@stylistic/computed-property-spacing": ["error", "never"],
Expand Down
12 changes: 6 additions & 6 deletions benches/language-transformer.bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('language transformer', () => {
'愛しかった',
'愛しくありません',
'愛しくありませんでした',
'愛しき'
'愛しき',
];

const verbInflections = [
Expand Down Expand Up @@ -80,14 +80,14 @@ describe('language transformer', () => {
'食べておる',
'食べてる',
'食べとる',
'食べてしまう'
'食べてしまう',
];

const inflectionCombinations = [
'抱き抱えていなければ',
'抱きかかえていなければ',
'打ち込んでいませんでした',
'食べさせられたくなかった'
'食べさせられたくなかった',
];

const kuruInflections = [
Expand Down Expand Up @@ -133,7 +133,7 @@ describe('language transformer', () => {
'きておる',
'きてる',
'きとる',
'きてしまう'
'きてしまう',
];

const suruInflections = [
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('language transformer', () => {
'しておる',
'してる',
'しとる',
'してしまう'
'してしまう',
];

const kansaibenInflections = [
Expand All @@ -195,7 +195,7 @@ describe('language transformer', () => {
'買わへんかった',
'買うて',
'買うた',
'買うたら'
'買うたら',
];

const basicTransformations = [...adjectiveInflections, ...verbInflections, ...inflectionCombinations];
Expand Down
24 changes: 12 additions & 12 deletions dev/bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ async function createZip(directory, excludeFiles, outputFileName, sevenZipExes,
'a',
outputFileName,
'.',
...excludeArguments
...excludeArguments,
],
{
cwd: directory
}
cwd: directory,
},
);
return;
} catch (e) {
Expand All @@ -85,7 +85,7 @@ async function createJSZip(directory, excludeFiles, outputFileName, onUpdate, dr
zip.file(
fileName.replace(/\\/g, '/'),
fs.readFileSync(path.join(directory, fileName), {encoding: null, flag: 'r'}),
{}
{},
);
}

Expand All @@ -96,7 +96,7 @@ async function createJSZip(directory, excludeFiles, outputFileName, onUpdate, dr
const data = await zip.generateAsync({
type: 'nodebuffer',
compression: 'DEFLATE',
compressionOptions: {level: 9}
compressionOptions: {level: 9},
}, onUpdate);
process.stdout.write('\n');

Expand Down Expand Up @@ -223,27 +223,27 @@ export async function main() {
const parseArgsConfigOptions = {
all: {
type: 'boolean',
default: false
default: false,
},
default: {
type: 'boolean',
default: false
default: false,
},
manifest: {
type: 'string'
type: 'string',
},
dryRun: {
type: 'boolean',
default: false
default: false,
},
dryRunBuildZip: {
type: 'boolean',
default: false
default: false,
},
version: {
type: 'string',
default: '0.0.0.0'
}
default: '0.0.0.0',
},
};

const argv = process.argv.slice(2);
Expand Down
2 changes: 1 addition & 1 deletion dev/bin/dictionary-validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function main() {
if (dictionaryFileNames.length === 0) {
console.log([
'Usage:',
' node dictionary-validate [--ajv] <dictionary-file-names>...'
' node dictionary-validate [--ajv] <dictionary-file-names>...',
].join('\n'));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion dev/bin/schema-validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function main() {
if (args.length < 2) {
console.log([
'Usage:',
' node schema-validate [--ajv] <schema-file-name> <data-file-names>...'
' node schema-validate [--ajv] <schema-file-name> <data-file-names>...',
].join('\n'));
return;
}
Expand Down
8 changes: 4 additions & 4 deletions dev/build-libs.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ async function buildLib(scriptPath) {
outfile: path.join(extDir, 'lib', path.basename(scriptPath)),
external: ['fs'],
banner: {
js: '// @ts-nocheck'
}
js: '// @ts-nocheck',
},
});
}

Expand All @@ -52,7 +52,7 @@ async function buildLib(scriptPath) {
export async function buildLibs() {
const devLibPath = path.join(dirname, 'lib');
const files = await fs.promises.readdir(devLibPath, {
withFileTypes: true
withFileTypes: true,
});
for (const f of files) {
if (f.isFile()) {
Expand All @@ -71,7 +71,7 @@ export async function buildLibs() {
const ajv = new Ajv({
schemas,
code: {source: true, esm: true},
allowUnionTypes: true
allowUnionTypes: true,
});
const moduleCode = standaloneCode(ajv);

Expand Down
2 changes: 1 addition & 1 deletion dev/dictionary-archive-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function createDictionaryArchiveData(dictionaryDirectory, dictionar
// Level 0 compression used since decompression in the node environment is not supported.
// See dev/lib/zip.js for more details.
const zipWriter = new ZipWriter(zipFileWriter, {
level: 0
level: 0,
});
for (const fileName of fileNames) {
if (/\.json$/.test(fileName)) {
Expand Down
4 changes: 2 additions & 2 deletions dev/dictionary-validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export async function validateDictionary(mode, archiveData, schemas) {
[/^term_meta_bank_(\d+)\.json$/, schemas.termMetaBankV3],
[/^kanji_bank_(\d+)\.json$/, version === 1 ? schemas.kanjiBankV1 : schemas.kanjiBankV3],
[/^kanji_meta_bank_(\d+)\.json$/, schemas.kanjiMetaBankV3],
[/^tag_bank_(\d+)\.json$/, schemas.tagBankV3]
[/^tag_bank_(\d+)\.json$/, schemas.tagBankV3],
];

await validateDictionaryBanks(mode, entries, schemasDetails);
Expand All @@ -118,7 +118,7 @@ export function getSchemas() {
tagBankV3: readSchema('../ext/data/schemas/dictionary-tag-bank-v3-schema.json'),
termBankV1: readSchema('../ext/data/schemas/dictionary-term-bank-v1-schema.json'),
termBankV3: readSchema('../ext/data/schemas/dictionary-term-bank-v3-schema.json'),
termMetaBankV3: readSchema('../ext/data/schemas/dictionary-term-meta-bank-v3-schema.json')
termMetaBankV3: readSchema('../ext/data/schemas/dictionary-term-meta-bank-v3-schema.json'),
};
}

Expand Down
6 changes: 3 additions & 3 deletions dev/generate-css-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export function getTargets() {
{
cssFilePath: path.join(dirname, '..', 'ext/css/structured-content.css'),
overridesCssFilePath: path.join(dirname, 'data/structured-content-overrides.css'),
outputPath: path.join(dirname, '..', 'ext/data/structured-content-style.json')
outputPath: path.join(dirname, '..', 'ext/data/structured-content-style.json'),
},
{
cssFilePath: path.join(dirname, '..', 'ext/css/display-pronunciation.css'),
overridesCssFilePath: path.join(dirname, 'data/display-pronunciation-overrides.css'),
outputPath: path.join(dirname, '..', 'ext/data/pronunciation-style.json')
}
outputPath: path.join(dirname, '..', 'ext/data/pronunciation-style.json'),
},
];
}

Expand Down
2 changes: 1 addition & 1 deletion dev/manifest-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class ManifestUtil {
const {stdout, stderr, status} = childProcess.spawnSync(command, args, {
cwd: dirname,
stdio: 'pipe',
shell: false
shell: false,
});
if (status !== 0) {
const message = stderr.toString('utf8').trim();
Expand Down
2 changes: 1 addition & 1 deletion dev/schema-validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class JsonSchemaAjv {
const ajv = new Ajv({
meta: false,
strictTuples: false,
allowUnionTypes: true
allowUnionTypes: true,
});
const metaSchemaPath = fileURLToPath(import.meta.resolve('ajv/dist/refs/json-schema-draft-07.json'));
/** @type {import('ajv').AnySchemaObject} */
Expand Down
4 changes: 2 additions & 2 deletions ext/js/accessibility/accessibility-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export class AccessibilityController {
js: [
xray ?
'js/accessibility/google-docs-xray.js' :
'js/accessibility/google-docs.js'
]
'js/accessibility/google-docs.js',
],
};
if (!xray) { details.world = 'MAIN'; }
return registerContentScript(id, details);
Expand Down
2 changes: 1 addition & 1 deletion ext/js/accessibility/google-docs-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class GoogleDocsUtil {
const style = document.createElement('style');
style.textContent = [
'.kix-canvas-tile-content{pointer-events:none!important;}',
'.kix-canvas-tile-content svg>g>rect{pointer-events:all!important;}'
'.kix-canvas-tile-content svg>g>rect{pointer-events:all!important;}',
].join('\n');
const parent = document.head || document.documentElement;
if (parent !== null) {
Expand Down
2 changes: 1 addition & 1 deletion ext/js/app/content-script-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ await Application.main(false, async (application) => {
canUseWindowPopup: true,
allowRootFramePopupProxy: true,
childrenSupported: true,
hotkeyHandler
hotkeyHandler,
});
await frontend.prepare();
});
Loading

0 comments on commit 76ca08b

Please sign in to comment.