Skip to content

Commit

Permalink
chore: Rename files with underscores (#17910)
Browse files Browse the repository at this point in the history
* chore: Rename files with underscores

* Fix tests
  • Loading branch information
nzakas committed Dec 28, 2023
1 parent d1018fc commit 02a8baf
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions tests/lib/cli.js
Expand Up @@ -638,7 +638,7 @@ describe("cli", () => {
if (useFlatConfig) {
it(`should not run rules set to 'warn' with configType:${configType}`, async () => {
const filePath = getFixturePath("single-quoted.js");
const configPath = getFixturePath("eslint.config_rule_throws.js");
const configPath = getFixturePath("eslint.config-rule-throws.js");
const cliArgs = `--quiet --config ${configPath}' ${filePath}`;

const exit = await cli.execute(cliArgs, null, useFlatConfig);
Expand All @@ -648,7 +648,7 @@ describe("cli", () => {

it(`should run rules set to 'warn' while maxWarnings is set with configType:${configType}`, async () => {
const filePath = getFixturePath("single-quoted.js");
const configPath = getFixturePath("eslint.config_rule_throws.js");
const configPath = getFixturePath("eslint.config-rule-throws.js");
const cliArgs = `--quiet --max-warnings=1 --config ${configPath}' ${filePath}`;

await stdAssert.rejects(async () => {
Expand Down Expand Up @@ -830,7 +830,7 @@ describe("cli", () => {
describe("when given a directory with eslint excluded files in the directory", () => {
it(`should throw an error and not process any files with configType:${configType}`, async () => {
const options = useFlatConfig
? `--config ${getFixturePath("eslint.config_with_ignores.js")}`
? `--config ${getFixturePath("eslint.config-with-ignores.js")}`
: `--ignore-path ${getFixturePath(".eslintignore")}`;
const filePath = getFixturePath("cli");
const expectedMessage = useFlatConfig
Expand All @@ -846,7 +846,7 @@ describe("cli", () => {
describe("when given a file in excluded files list", () => {
it(`should not process the file with configType:${configType}`, async () => {
const options = useFlatConfig
? `--config ${getFixturePath("eslint.config_with_ignores.js")}`
? `--config ${getFixturePath("eslint.config-with-ignores.js")}`
: `--ignore-path ${getFixturePath(".eslintignore")}`;
const filePath = getFixturePath("passing.js");
const exit = await cli.execute(`${options} ${filePath}`, null, useFlatConfig);
Expand All @@ -858,7 +858,7 @@ describe("cli", () => {

it(`should process the file when forced with configType:${configType}`, async () => {
const options = useFlatConfig
? `--config ${getFixturePath("eslint.config_with_ignores.js")}`
? `--config ${getFixturePath("eslint.config-with-ignores.js")}`
: `--ignore-path ${getFixturePath(".eslintignore")}`;
const filePath = getFixturePath("passing.js");
const exit = await cli.execute(`${options} --no-ignore ${filePath}`, null, useFlatConfig);
Expand All @@ -870,7 +870,7 @@ describe("cli", () => {

it(`should suppress the warning if --no-warn-ignored is passed with configType:${configType}`, async () => {
const options = useFlatConfig
? `--config ${getFixturePath("eslint.config_with_ignores.js")}`
? `--config ${getFixturePath("eslint.config-with-ignores.js")}`
: `--ignore-path ${getFixturePath(".eslintignore")}`;
const filePath = getFixturePath("passing.js");
const exit = await cli.execute(`${options} --no-warn-ignored ${filePath}`, null, useFlatConfig);
Expand All @@ -890,7 +890,7 @@ describe("cli", () => {

it(`should suppress the warning if --no-warn-ignored is passed and an ignored file is passed via stdin with configType:${configType}`, async () => {
const options = useFlatConfig
? `--config ${getFixturePath("eslint.config_with_ignores.js")}`
? `--config ${getFixturePath("eslint.config-with-ignores.js")}`
: `--ignore-path ${getFixturePath(".eslintignore")}`;
const filePath = getFixturePath("passing.js");
const exit = await cli.execute(`${options} --no-warn-ignored --stdin --stdin-filename ${filePath}`, "foo", useFlatConfig);
Expand Down
38 changes: 19 additions & 19 deletions tests/lib/eslint/flat-eslint.js
Expand Up @@ -368,7 +368,7 @@ describe("FlatESLint", () => {
it("should return a warning when given a filename by --stdin-filename in excluded files list if warnIgnored is true", async () => {
eslint = new FlatESLint({
cwd: getFixturePath(".."),
overrideConfigFile: "fixtures/eslint.config_with_ignores.js"
overrideConfigFile: "fixtures/eslint.config-with-ignores.js"
});

const options = { filePath: "fixtures/passing.js", warnIgnored: true };
Expand All @@ -391,7 +391,7 @@ describe("FlatESLint", () => {
it("should return a warning when given a filename by --stdin-filename in excluded files list if constructor warnIgnored is false, but lintText warnIgnored is true", async () => {
eslint = new FlatESLint({
cwd: getFixturePath(".."),
overrideConfigFile: "fixtures/eslint.config_with_ignores.js",
overrideConfigFile: "fixtures/eslint.config-with-ignores.js",
warnIgnored: false
});

Expand All @@ -415,7 +415,7 @@ describe("FlatESLint", () => {
it("should not return a warning when given a filename by --stdin-filename in excluded files list if warnIgnored is false", async () => {
eslint = new FlatESLint({
cwd: getFixturePath(".."),
overrideConfigFile: "fixtures/eslint.config_with_ignores.js"
overrideConfigFile: "fixtures/eslint.config-with-ignores.js"
});
const options = {
filePath: "fixtures/passing.js",
Expand All @@ -432,7 +432,7 @@ describe("FlatESLint", () => {
it("should not return a warning when given a filename by --stdin-filename in excluded files list if constructor warnIgnored is false", async () => {
eslint = new FlatESLint({
cwd: getFixturePath(".."),
overrideConfigFile: "fixtures/eslint.config_with_ignores.js",
overrideConfigFile: "fixtures/eslint.config-with-ignores.js",
warnIgnored: false
});
const options = { filePath: "fixtures/passing.js" };
Expand All @@ -445,7 +445,7 @@ describe("FlatESLint", () => {
it("should show excluded file warnings by default", async () => {
eslint = new FlatESLint({
cwd: getFixturePath(".."),
overrideConfigFile: "fixtures/eslint.config_with_ignores.js"
overrideConfigFile: "fixtures/eslint.config-with-ignores.js"
});
const options = { filePath: "fixtures/passing.js" };
const results = await eslint.lintText("var bar = foo;", options);
Expand All @@ -458,7 +458,7 @@ describe("FlatESLint", () => {
eslint = new FlatESLint({
cwd: getFixturePath(".."),
ignore: false,
overrideConfigFile: "fixtures/eslint.config_with_ignores.js",
overrideConfigFile: "fixtures/eslint.config-with-ignores.js",
overrideConfig: {
rules: {
"no-undef": 2
Expand Down Expand Up @@ -1527,7 +1527,7 @@ describe("FlatESLint", () => {

it("should throw an error when all given files are ignored", async () => {
eslint = new FlatESLint({
overrideConfigFile: getFixturePath("eslint.config_with_ignores.js")
overrideConfigFile: getFixturePath("eslint.config-with-ignores.js")
});

await assert.rejects(async () => {
Expand All @@ -1537,7 +1537,7 @@ describe("FlatESLint", () => {

it("should throw an error when all given files are ignored even with a `./` prefix", async () => {
eslint = new FlatESLint({
overrideConfigFile: getFixturePath("eslint.config_with_ignores.js")
overrideConfigFile: getFixturePath("eslint.config-with-ignores.js")
});

await assert.rejects(async () => {
Expand Down Expand Up @@ -1569,7 +1569,7 @@ describe("FlatESLint", () => {
// https://github.com/eslint/eslint/issues/3812
it("should ignore all files and throw an error when **/fixtures/** is in `ignores` in the config file", async () => {
eslint = new FlatESLint({
overrideConfigFile: getFixturePath("cli-engine/eslint.config_with_ignores2.js"),
overrideConfigFile: getFixturePath("cli-engine/eslint.config-with-ignores2.js"),
overrideConfig: {
rules: {
quotes: [2, "double"]
Expand Down Expand Up @@ -1607,7 +1607,7 @@ describe("FlatESLint", () => {

it("should return a warning when an explicitly given file is ignored", async () => {
eslint = new FlatESLint({
overrideConfigFile: "eslint.config_with_ignores.js",
overrideConfigFile: "eslint.config-with-ignores.js",
cwd: getFixturePath()
});
const filePath = getFixturePath("passing.js");
Expand All @@ -1627,7 +1627,7 @@ describe("FlatESLint", () => {

it("should suppress the warning when an explicitly given file is ignored and warnIgnored is false", async () => {
eslint = new FlatESLint({
overrideConfigFile: "eslint.config_with_ignores.js",
overrideConfigFile: "eslint.config-with-ignores.js",
cwd: getFixturePath(),
warnIgnored: false
});
Expand All @@ -1639,7 +1639,7 @@ describe("FlatESLint", () => {

it("should return a warning about matching ignore patterns when an explicitly given dotfile is ignored", async () => {
eslint = new FlatESLint({
overrideConfigFile: "eslint.config_with_ignores.js",
overrideConfigFile: "eslint.config-with-ignores.js",
cwd: getFixturePath()
});
const filePath = getFixturePath("dot-files/.a.js");
Expand All @@ -1661,7 +1661,7 @@ describe("FlatESLint", () => {
eslint = new FlatESLint({
cwd: getFixturePath(),
ignore: false,
overrideConfigFile: getFixturePath("eslint.config_with_ignores.js"),
overrideConfigFile: getFixturePath("eslint.config-with-ignores.js"),
overrideConfig: {
rules: {
"no-undef": 2
Expand Down Expand Up @@ -4249,7 +4249,7 @@ describe("FlatESLint", () => {
describe("isPathIgnored", () => {
it("should check if the given path is ignored", async () => {
const engine = new FlatESLint({
overrideConfigFile: getFixturePath("eslint.config_with_ignores2.js"),
overrideConfigFile: getFixturePath("eslint.config-with-ignores2.js"),
cwd: getFixturePath()
});

Expand All @@ -4260,7 +4260,7 @@ describe("FlatESLint", () => {
it("should return false if ignoring is disabled", async () => {
const engine = new FlatESLint({
ignore: false,
overrideConfigFile: getFixturePath("eslint.config_with_ignores2.js"),
overrideConfigFile: getFixturePath("eslint.config-with-ignores2.js"),
cwd: getFixturePath()
});

Expand Down Expand Up @@ -4453,7 +4453,7 @@ describe("FlatESLint", () => {
it("should return false for ignored file when unignored with ignore pattern", async () => {
const cwd = getFixturePath("ignored-paths");
const engine = new FlatESLint({
overrideConfigFile: getFixturePath("eslint.config_with_ignores2.js"),
overrideConfigFile: getFixturePath("eslint.config-with-ignores2.js"),
ignorePatterns: ["!undef.js"],
cwd
});
Expand Down Expand Up @@ -4653,7 +4653,7 @@ describe("FlatESLint", () => {

it("should return 0 error or warning messages even when the file has warnings", async () => {
const engine = new FlatESLint({
overrideConfigFile: getFixturePath("eslint.config_with_ignores.js"),
overrideConfigFile: getFixturePath("eslint.config-with-ignores.js"),
cwd: path.join(fixtureDir, "..")
});
const options = {
Expand Down Expand Up @@ -6187,7 +6187,7 @@ describe("FlatESLint", () => {

it("should be inserted before configs from the config file and overrideConfig", async () => {
const eslint = new FlatESLint({
overrideConfigFile: getFixturePath("eslint.config_with_rules.js"),
overrideConfigFile: getFixturePath("eslint.config-with-rules.js"),
baseConfig: {
rules: {
quotes: ["error", "double"],
Expand All @@ -6205,7 +6205,7 @@ describe("FlatESLint", () => {

/*
* baseConfig: { quotes: ["error", "double"], semi: "error" }
* eslint.config_with_rules.js: { quotes: ["error", "single"] }
* eslint.config-with-rules.js: { quotes: ["error", "single"] }
* overrideConfig: { quotes: "warn" }
*
* Merged config: { quotes: ["warn", "single"], semi: "error" }
Expand Down

0 comments on commit 02a8baf

Please sign in to comment.