mirror of
https://github.com/hanzoai/eslint.git
synced 2026-10-30 19:38:10 +00:00
* feat!: remove eslintrc support from CLI * remove link * remove `null` * remove unnecessary check * remove warning about using eslint.config.js * update `docs/src/use/command-line-interface.md` * add `--parser` and `--plugin` tests * Update lib/options.js Co-authored-by: Milos Djermanovic <[email protected]> * Update lib/options.js Co-authored-by: Milos Djermanovic <[email protected]> * feat: Remove eslintrc methods from Linter closes #13481 * Fix linter warnings * Remove eslintrc references * Fix failing tests * Fix failing test * Fix types test * Remove unnecessary dependencies * Clean up loadESLint types * Remove parserPath/parserOptions * Update loadESLint() docs * Update docs/src/integrate/nodejs-api.md Co-authored-by: Francesco Trotta <[email protected]> * Remove unneeded types and code * Update tests/lib/types/types.test.ts Co-authored-by: Francesco Trotta <[email protected]> * Fix types * fix linter and tests * fix format * fix knip * Update lib/linter/linter.js Co-authored-by: Milos Djermanovic <[email protected]> * update migration guide --------- Co-authored-by: Milos Djermanovic <[email protected]> Co-authored-by: Nicholas C. Zakas <[email protected]>
74 lines
1.8 KiB
JavaScript
74 lines
1.8 KiB
JavaScript
/**
|
|
* @fileoverview Tests for api.
|
|
* @author Gyandeep Singh
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Requirements
|
|
//-----------------------------------------------------------------------------
|
|
|
|
const assert = require("chai").assert,
|
|
api = require("../../lib/api");
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Tests
|
|
//-----------------------------------------------------------------------------
|
|
|
|
describe("api", () => {
|
|
it("should have ESLint exposed", () => {
|
|
assert.isFunction(api.ESLint);
|
|
});
|
|
|
|
it("should have RuleTester exposed", () => {
|
|
assert.isFunction(api.RuleTester);
|
|
});
|
|
|
|
it("should not have CLIEngine exposed", () => {
|
|
assert.isUndefined(api.CLIEngine);
|
|
});
|
|
|
|
it("should not have linter exposed", () => {
|
|
assert.isUndefined(api.linter);
|
|
});
|
|
|
|
it("should have Linter exposed", () => {
|
|
assert.isFunction(api.Linter);
|
|
});
|
|
|
|
it("should have SourceCode exposed", () => {
|
|
assert.isFunction(api.SourceCode);
|
|
});
|
|
|
|
describe("loadESLint", () => {
|
|
afterEach(() => {
|
|
delete process.env.ESLINT_USE_FLAT_CONFIG;
|
|
});
|
|
|
|
it("should be a function", () => {
|
|
assert.isFunction(api.loadESLint);
|
|
});
|
|
|
|
it("should return a Promise", () => {
|
|
assert.instanceOf(api.loadESLint(), Promise);
|
|
});
|
|
|
|
it("should return ESLint when useFlatConfig is true", async () => {
|
|
assert.strictEqual(
|
|
await api.loadESLint({ useFlatConfig: true }),
|
|
api.ESLint,
|
|
);
|
|
});
|
|
|
|
it("should return ESLint when useFlatConfig is not provided", async () => {
|
|
assert.strictEqual(await api.loadESLint(), api.ESLint);
|
|
});
|
|
|
|
it("should return ESLint when useFlatConfig is not provided and ESLINT_USE_FLAT_CONFIG is true", async () => {
|
|
process.env.ESLINT_USE_FLAT_CONFIG = "true";
|
|
assert.strictEqual(await api.loadESLint(), api.ESLint);
|
|
});
|
|
});
|
|
});
|