Files
electron/script/lint-plugins/no-only-tests.mjs
Samuel Attard 6ed3198ba8 build: migrate from eslint to oxlint (#50691)
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.
2026-04-06 09:05:13 -07:00

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`
});
}
}
};
}
}
}
};