blob: 580e608914c443c17fd6dc906f57f965c8c6ec14 [file] [edit]
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import tsParser from '@typescript-eslint/parser';
import {RuleTester} from '@typescript-eslint/rule-tester';
import {after, describe, it} from 'mocha';
// Add the mocha functions to the rule tester. The test runner does not expose
// them as globals (see test/scripts/run_mocha.ts), which RuleTester otherwise
// falls back to.
RuleTester.afterAll = after;
RuleTester.describe = describe;
RuleTester.describeSkip = describe.skip;
RuleTester.it = it;
RuleTester.itOnly = it.only;
RuleTester.itSkip = it.skip;
/**
* Provide this when you have a rule that needs to use TypeScript
* typechecking resolutions in EsLint rule.
*/
const typeCheckingOptions = {
languageOptions: {
ecmaVersion: 'latest' as const,
sourceType: 'module' as const,
parser: tsParser,
parserOptions: {
projectService: {
allowDefaultProject: ['*.ts'],
},
},
},
};
export {RuleTester, typeCheckingOptions};