Skip to content

Commit 0a9a9dd

Browse files
authored
Merge pull request #426 from lo1tuma/make-rules-js-only
Declare rules as JS-only
2 parents f6992f4 + 8d0cf3d commit 0a9a9dd

26 files changed

Lines changed: 31 additions & 0 deletions

source/plugin.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ describe('eslint-plugin-mocha', function () {
5454
}
5555
});
5656

57+
it('should declare all rules as js-only', function () {
58+
for (const rule of Object.values(plugin.rules)) {
59+
assert.deepStrictEqual(rule.meta?.languages, ['js/js']);
60+
}
61+
});
62+
5763
describe('documentation', function () {
5864
it('should have each rule documented', async function () {
5965
const ruleFiles = await determineAllRuleFiles();

source/rules/consistent-interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ export function reportUnexpectedImportBindingsInModule(
288288
export const consistentInterfaceRule: Readonly<Rule.RuleModule> = {
289289
meta: {
290290
type: 'problem',
291+
languages: ['js/js'],
291292
docs: {
292293
description: 'Enforces consistent use of mocha interfaces',
293294
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/documentation/rules/consistent-interface.md'

source/rules/consistent-spacing-between-blocks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ function getSpacingCheck(
105105
export const consistentSpacingBetweenBlocksRule: Readonly<Rule.RuleModule> = {
106106
meta: {
107107
type: 'suggestion',
108+
languages: ['js/js'],
108109
fixable: 'whitespace',
109110
schema: [],
110111
messages: {

source/rules/handle-done-callback.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function findParamInScope(
3030
export const handleDoneCallbackRule: Readonly<Rule.RuleModule> = {
3131
meta: {
3232
type: 'problem',
33+
languages: ['js/js'],
3334
docs: {
3435
description: 'Enforces handling of callbacks for async tests',
3536
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/documentation/rules/handle-done-callback.md'

source/rules/max-top-level-suites.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function isTopLevelScope(scope: Readonly<Scope.Scope>): boolean {
2424
export const maxTopLevelSuitesRule: Readonly<Rule.RuleModule> = {
2525
meta: {
2626
type: 'suggestion',
27+
languages: ['js/js'],
2728
docs: {
2829
description: 'Enforce the number of top-level suites in a single file',
2930
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/documentation/rules/max-top-level-suites.md'

source/rules/no-async-suite.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export function fixAsyncFunction(
9393
export const noAsyncSuiteRule: Readonly<Rule.RuleModule> = {
9494
meta: {
9595
type: 'problem',
96+
languages: ['js/js'],
9697
docs: {
9798
description: 'Disallow async functions passed to a suite',
9899
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/documentation/rules/no-async-suite.md'

source/rules/no-empty-title.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function isValidDescriptionArgumentNode(node: Except<Rule.Node, 'parent'> | unde
5959
export const noEmptyTitleRule: Readonly<Rule.RuleModule> = {
6060
meta: {
6161
type: 'suggestion',
62+
languages: ['js/js'],
6263
docs: {
6364
description: 'Disallow empty test descriptions',
6465
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/documentation/rules/no-empty-title.md'

source/rules/no-exclusive-tests.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { CallExpression, MemberExpression } from '../ast/node-types.js';
55
export const noExclusiveTestsRule: Readonly<Rule.RuleModule> = {
66
meta: {
77
type: 'problem',
8+
languages: ['js/js'],
89
docs: {
910
description: 'Disallow exclusive tests',
1011
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/documentation/rules/no-exclusive-tests.md'

source/rules/no-exports.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const noExportsRule: Readonly<Rule.RuleModule> = {
1111
unexpectedExport: 'Unexpected export from a test file'
1212
},
1313
type: 'suggestion',
14+
languages: ['js/js'],
1415
schema: []
1516
},
1617
create(context) {

source/rules/no-global-tests.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function isGlobalScope(scope: Readonly<Scope.Scope>): boolean {
88
export const noGlobalTestsRule: Readonly<Rule.RuleModule> = {
99
meta: {
1010
type: 'suggestion',
11+
languages: ['js/js'],
1112
docs: {
1213
description: 'Disallow global tests',
1314
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/documentation/rules/no-global-tests.md'

0 commit comments

Comments
 (0)