mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
chore: Migrate ESLint configuration file to new flat format. (#8675)
* chore: rename .eslintrc.js to eslint.config.js * chore: Rename eslint.config.js to eslint.config.mjs. * refactor: Migrate ESLint config to new flat format. * chore: Remove old per-directory and global ignore ESLint config files. * fix: Allowlist JSDoc tag aliases. * fix: Don't require @license in tests/*. * fix: Add NodeJS globals to several files that run under Node. * chore: Remove now-unneeded ESLint directives in core. * chore: Remove invalid/unneeded ESLint directives. * fix: Fix invalid use of `await` outside of an `async` function. * fix: Improve screenshot error message. * fix: Update ESLint config file to not warn on existing violations. * chore: Remove suppressions of rules that weren't triggering. * chore: Fix package-lock.json.
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"globals": {
|
||||
"Blockly": true,
|
||||
"dartGenerator": true,
|
||||
"javascriptGenerator": true,
|
||||
"luaGenerator": true,
|
||||
"phpGenerator": true,
|
||||
"pythonGenerator": true
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"mocha": true,
|
||||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"chai": false,
|
||||
"sinon": false
|
||||
},
|
||||
"rules": {
|
||||
"no-unused-vars": ["off"],
|
||||
// Allow uncommented helper functions in tests.
|
||||
"require-jsdoc": ["off"],
|
||||
"prefer-rest-params": ["off"],
|
||||
"no-invalid-this": ["off"],
|
||||
"valid-jsdoc": [
|
||||
"error",
|
||||
{
|
||||
"requireReturnType": false,
|
||||
"requireParamType": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"extends": "../../.eslintrc.js",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
||||
@@ -25,38 +25,39 @@ const RENAMINGS_URL = new URL(
|
||||
import.meta.url,
|
||||
);
|
||||
|
||||
const renamingsJson5 = await readFile(RENAMINGS_URL);
|
||||
const renamings = JSON5.parse(renamingsJson5);
|
||||
readFile(RENAMINGS_URL).then((renamingsJson5) => {
|
||||
const renamings = JSON5.parse(renamingsJson5);
|
||||
|
||||
const output = await validate(SCHEMA_URL, renamings, BASIC);
|
||||
|
||||
if (!output.valid) {
|
||||
console.error(`Renamings file is invalid. First error occurs at:
|
||||
validate(SCHEMA_URL, renamings, BASIC).then((output) => {
|
||||
if (!output.valid) {
|
||||
console.error(`Renamings file is invalid. First error occurs at:
|
||||
${output.errors[0].instanceLocation}`);
|
||||
console.info(
|
||||
`Here is the full validator output, in case that helps:\n`,
|
||||
output,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// File passed schema validation. Do some additional checks.
|
||||
let ok = true;
|
||||
Object.entries(renamings).forEach(([version, modules]) => {
|
||||
// Scan through modules and check for duplicates.
|
||||
const seen = new Set();
|
||||
for (const {oldName} of modules) {
|
||||
if (seen.has(oldName)) {
|
||||
console.error(
|
||||
`Duplicate entry for module ${oldName} ` + `in version ${version}.`,
|
||||
console.info(
|
||||
`Here is the full validator output, in case that helps:\n`,
|
||||
output,
|
||||
);
|
||||
ok = false;
|
||||
process.exit(1);
|
||||
}
|
||||
seen.add(oldName);
|
||||
}
|
||||
|
||||
// File passed schema validation. Do some additional checks.
|
||||
let ok = true;
|
||||
Object.entries(renamings).forEach(([version, modules]) => {
|
||||
// Scan through modules and check for duplicates.
|
||||
const seen = new Set();
|
||||
for (const {oldName} of modules) {
|
||||
if (seen.has(oldName)) {
|
||||
console.error(
|
||||
`Duplicate entry for module ${oldName} ` + `in version ${version}.`,
|
||||
);
|
||||
ok = false;
|
||||
}
|
||||
seen.add(oldName);
|
||||
}
|
||||
});
|
||||
if (!ok) {
|
||||
console.error('Renamings file is invalid.');
|
||||
process.exit(1);
|
||||
}
|
||||
// Default is a successful exit 0.
|
||||
});
|
||||
});
|
||||
if (!ok) {
|
||||
console.error('Renamings file is invalid.');
|
||||
process.exit(1);
|
||||
}
|
||||
// Default is a successful exit 0.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"mocha": true
|
||||
},
|
||||
"globals": {
|
||||
"chai": false,
|
||||
"sinon": false
|
||||
},
|
||||
"rules": {
|
||||
"no-unused-vars": ["off"],
|
||||
// Allow uncommented helper functions in tests.
|
||||
"require-jsdoc": ["off"],
|
||||
"prefer-rest-params": ["off"],
|
||||
"no-invalid-this": ["off"]
|
||||
},
|
||||
"extends": "../../.eslintrc.js",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
||||
@@ -484,7 +484,6 @@ Serializer.Fields.TextInput.Simple = new SerializerTestCase(
|
||||
'</block>' +
|
||||
'</xml>',
|
||||
);
|
||||
/* eslint-disable no-tabs */
|
||||
Serializer.Fields.TextInput.Tabs = new SerializerTestCase(
|
||||
'Tabs',
|
||||
'<xml xmlns="https://developers.google.com/blockly/xml">' +
|
||||
@@ -493,7 +492,6 @@ Serializer.Fields.TextInput.Tabs = new SerializerTestCase(
|
||||
'</block>' +
|
||||
'</xml>',
|
||||
);
|
||||
/* eslint-enable no-tabs */
|
||||
Serializer.Fields.TextInput.Symbols = new SerializerTestCase(
|
||||
'Symbols',
|
||||
'<xml xmlns="https://developers.google.com/blockly/xml">' +
|
||||
@@ -621,7 +619,6 @@ Serializer.Fields.Variable.Types = new SerializerTestCase(
|
||||
'</block>' +
|
||||
'</xml>',
|
||||
);
|
||||
/* eslint-disable no-tabs */
|
||||
Serializer.Fields.Variable.Tabs = new SerializerTestCase(
|
||||
'Tabs',
|
||||
'<xml xmlns="https://developers.google.com/blockly/xml">' +
|
||||
@@ -633,7 +630,6 @@ Serializer.Fields.Variable.Tabs = new SerializerTestCase(
|
||||
'</block>' +
|
||||
'</xml>',
|
||||
);
|
||||
/* eslint-enable no-tabs */
|
||||
Serializer.Fields.Variable.Symbols = new SerializerTestCase(
|
||||
'Symbols',
|
||||
'<xml xmlns="https://developers.google.com/blockly/xml">' +
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable valid-jsdoc */
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
|
||||
@@ -20,6 +20,5 @@ suite('Workspace', function () {
|
||||
sharedTestTeardown.call(this);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
testAWorkspace();
|
||||
});
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": false,
|
||||
"mocha": true
|
||||
},
|
||||
"globals": {
|
||||
"console": true,
|
||||
"require": true
|
||||
},
|
||||
"extends": "../../.eslintrc.js"
|
||||
}
|
||||
@@ -40,7 +40,7 @@ function svgToPng_(data, width, height, callback) {
|
||||
const dataUri = canvas.toDataURL('image/png');
|
||||
callback(dataUri);
|
||||
} catch (err) {
|
||||
console.warn('Error converting the workspace svg to a png');
|
||||
console.warn('Error converting the workspace svg to a png: ' + err);
|
||||
callback('');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user