mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Consolidates the root .eslintrc.json and five nested configs (build, script, docs, default_app, spec) into a single .oxlintrc.json at the repo root. script/lint.js now shells out to the oxlint binary from node_modules/.bin instead of using the ESLint Node API, and emits GitHub Actions annotations directly via --format=github in CI (replacing the deleted eslint-stylish problem matcher). Oxlint has no markdown processor, so the ESLint-based lint of JS code blocks in docs/**/*.md is replaced with an inline regex check for bare Node.js builtin imports. This preserves the rule docs/.eslintrc.json was originally added for in #42113; the rest of the standard ruleset on docs code blocks was already being enforced in parallel by lint-roller-markdown-standard.
28 lines
728 B
JavaScript
28 lines
728 B
JavaScript
const BLOCK_NAMES = new Set(['describe', 'it', 'context', 'test', 'specify', 'suite']);
|
|
|
|
export default {
|
|
meta: { name: 'no-only-tests' },
|
|
rules: {
|
|
'no-only-tests': {
|
|
meta: { type: 'problem' },
|
|
create (context) {
|
|
return {
|
|
MemberExpression (node) {
|
|
if (
|
|
node.property.type === 'Identifier' &&
|
|
node.property.name === 'only' &&
|
|
node.object.type === 'Identifier' &&
|
|
BLOCK_NAMES.has(node.object.name)
|
|
) {
|
|
context.report({
|
|
node: node.property,
|
|
message: `${node.object.name}.only not permitted`
|
|
});
|
|
}
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|
|
};
|