-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Package-specific migration bugs (#107)
- Loading branch information
Showing
6 changed files
with
108 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* @fileoverview A list of shareable configs that need the compat utility. | ||
* @author Nicholas C. Zakas | ||
*/ | ||
|
||
export default ["eslint-config-react-app"]; |
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
12 changes: 12 additions & 0 deletions
12
packages/migrate-config/tests/fixtures/slash-package/.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,12 @@ | ||
{ | ||
"extends": [ | ||
"react-app", | ||
"prettier", | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:@tanstack/eslint-plugin-query/recommended" | ||
], | ||
"plugins": [ | ||
"jsx-a11y", | ||
"@tanstack/query" | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
packages/migrate-config/tests/fixtures/slash-package/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,30 @@ | ||
const { | ||
fixupConfigRules, | ||
fixupPluginRules, | ||
} = require("@eslint/compat"); | ||
|
||
const jsxA11Y = require("eslint-plugin-jsx-a11y"); | ||
const tanstackQuery = require("@tanstack/eslint-plugin-query"); | ||
const js = require("@eslint/js"); | ||
|
||
const { | ||
FlatCompat, | ||
} = require("@eslint/eslintrc"); | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}); | ||
|
||
module.exports = [...fixupConfigRules(compat.extends( | ||
"react-app", | ||
"prettier", | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:@tanstack/eslint-plugin-query/recommended", | ||
)), { | ||
plugins: { | ||
"jsx-a11y": fixupPluginRules(jsxA11Y), | ||
"@tanstack/query": fixupPluginRules(tanstackQuery), | ||
}, | ||
}]; |
27 changes: 27 additions & 0 deletions
27
packages/migrate-config/tests/fixtures/slash-package/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,27 @@ | ||
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat"; | ||
import jsxA11Y from "eslint-plugin-jsx-a11y"; | ||
import tanstackQuery from "@tanstack/eslint-plugin-query"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
|
||
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 | ||
}); | ||
|
||
export default [...fixupConfigRules(compat.extends( | ||
"react-app", | ||
"prettier", | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:@tanstack/eslint-plugin-query/recommended", | ||
)), { | ||
plugins: { | ||
"jsx-a11y": fixupPluginRules(jsxA11Y), | ||
"@tanstack/query": fixupPluginRules(tanstackQuery), | ||
}, | ||
}]; |
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