-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add --gitignore flag to read in .gitignore files (#55)
- Loading branch information
Showing
19 changed files
with
224 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/migrate-config/tests/fixtures/gitignore-complex/.eslintrc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"ignorePatterns": ["baz"], | ||
"extends": ["eslint:recommended"], | ||
"rules": { | ||
"no-console": "off" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/migrate-config/tests/fixtures/gitignore-complex/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist | ||
foo/bar | ||
*.log |
25 changes: 25 additions & 0 deletions
25
packages/migrate-config/tests/fixtures/gitignore-complex/expected.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const js = require("@eslint/js"); | ||
|
||
const { | ||
FlatCompat, | ||
} = require("@eslint/eslintrc"); | ||
|
||
const { | ||
includeIgnoreFile, | ||
} = require("@eslint/compat"); | ||
|
||
const path = require("node:path"); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}); | ||
const gitignorePath = path.resolve(__dirname, ".gitignore"); | ||
|
||
module.exports = [{ | ||
ignores: ["**/baz"], | ||
}, includeIgnoreFile(gitignorePath), ...compat.extends("eslint:recommended"), { | ||
rules: { | ||
"no-console": "off", | ||
}, | ||
}]; |
22 changes: 22 additions & 0 deletions
22
packages/migrate-config/tests/fixtures/gitignore-complex/expected.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
import { includeIgnoreFile } from "@eslint/compat"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}); | ||
const gitignorePath = path.resolve(__dirname, ".gitignore"); | ||
|
||
export default [{ | ||
ignores: ["**/baz"], | ||
}, includeIgnoreFile(gitignorePath), ...compat.extends("eslint:recommended"), { | ||
rules: { | ||
"no-console": "off", | ||
}, | ||
}]; |
5 changes: 5 additions & 0 deletions
5
packages/migrate-config/tests/fixtures/gitignore-simple/.eslintrc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"no-console": "off" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/migrate-config/tests/fixtures/gitignore-simple/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist | ||
foo/bar | ||
*.log |
12 changes: 12 additions & 0 deletions
12
packages/migrate-config/tests/fixtures/gitignore-simple/expected.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { | ||
includeIgnoreFile, | ||
} = require("@eslint/compat"); | ||
|
||
const path = require("node:path"); | ||
const gitignorePath = path.resolve(__dirname, ".gitignore"); | ||
|
||
module.exports = [includeIgnoreFile(gitignorePath), { | ||
rules: { | ||
"no-console": "off", | ||
}, | ||
}]; |
13 changes: 13 additions & 0 deletions
13
packages/migrate-config/tests/fixtures/gitignore-simple/expected.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { includeIgnoreFile } from "@eslint/compat"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const gitignorePath = path.resolve(__dirname, ".gitignore"); | ||
|
||
export default [includeIgnoreFile(gitignorePath), { | ||
rules: { | ||
"no-console": "off", | ||
}, | ||
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.