Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: eslint-plugin-import usage in VSCode with Yarn PnP #1984

Merged
merged 2 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ module.exports = {

extends: [
"eslint:recommended",
"plugin:import/recommended",
// https://github.com/microsoft/vscode-eslint/issues/1494
process.env.NODE_ENV !== "EDITOR" && "plugin:import/recommended",
process.env.NODE_ENV !== "EDITOR" && "plugin:import/typescript",
"plugin:react-hooks/recommended",
"prettier",
],
].filter(Boolean),

parserOptions: {
ecmaVersion: 2022,
Expand All @@ -30,10 +32,7 @@ module.exports = {
{
files: ["*.ts", "*.tsx"],
parser: "@typescript-eslint/parser",
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
],
extends: ["plugin:@typescript-eslint/recommended"],
plugins: ["@typescript-eslint"],
parserOptions: {
warnOnUnsupportedTypeScriptVersion: true,
Expand Down Expand Up @@ -69,7 +68,10 @@ module.exports = {

settings: {
"import/resolver": {
typescript: {},
typescript: {
project: ["app/tsconfig.json", "edge/tsconfig.json"],
},
},
"import/core-modules": ["__STATIC_CONTENT_MANIFEST"],
},
};
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"editor.formatOnSave": true,
"editor.tabSize": 2,
"eslint.nodePath": ".yarn/sdks",
"eslint.runtime": "node",
"eslint.nodeEnv": "EDITOR",
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
Expand Down
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@mui/icons-material": "^5.8.4",
"@mui/lab": "^5.0.0-alpha.92",
"@mui/material": "^5.9.2",
"@mui/lab": "^5.0.0-alpha.93",
"@mui/material": "^5.9.3",
"firebase": "^9.9.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
13 changes: 6 additions & 7 deletions app/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* SPDX-FileCopyrightText: 2014-present Kriasoft */
/* SPDX-License-Identifier: MIT */
/* eslint import/namespace: ["error", { allowComputed: true }] */

import { PaletteMode } from "@mui/material";
import { PaletteOptions } from "@mui/material";
import { createTheme } from "@mui/material/styles";
import { components } from "./components.js";
import * as palettes from "./palettes.js";
Expand All @@ -12,12 +11,12 @@ import * as typography from "./typography.js";
* Creates a customized Material UI theme
* https://next.material-ui.com/customization/default-theme/
*/
function createCustomTheme(theme: PaletteMode) {
const { palette } = createTheme({ palette: palettes[theme] });
function createCustomTheme(paletteOptions: PaletteOptions) {
const { palette } = createTheme({ palette: paletteOptions });

return createTheme(
{
palette: palettes[theme],
palette,
typography: typography.options,
components: components(palette),
},
Expand All @@ -27,5 +26,5 @@ function createCustomTheme(theme: PaletteMode) {
);
}

export const light = createCustomTheme("light");
export const dark = createCustomTheme("dark");
export const light = createCustomTheme(palettes.dark);
export const dark = createCustomTheme(palettes.light);
1 change: 0 additions & 1 deletion edge/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* SPDX-FileCopyrightText: 2014-present Kriasoft */
/* SPDX-License-Identifier: MIT */
/* eslint import/no-unresolved: [2, { ignore: ["__STATIC_CONTENT_MANIFEST"] }] */

import {
getAssetFromKV,
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"build": "yarn workspaces foreach -ti run build"
},
"devDependencies": {
"@babel/cli": "^7.18.9",
"@babel/core": "^7.18.9",
"@babel/cli": "^7.18.10",
"@babel/core": "^7.18.10",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
"@babel/plugin-transform-runtime": "^7.18.9",
"@babel/preset-env": "^7.18.9",
"@babel/plugin-transform-runtime": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@babel/register": "^7.18.9",
Expand All @@ -37,8 +37,8 @@
"@types/babel__preset-env": "^7.9.2",
"@types/eslint": "^8.4.5",
"@types/prettier": "^2.6.4",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"babel-jest": "^28.1.3",
"babel-plugin-import": "^1.13.5",
"cross-spawn": "^7.0.3",
Expand All @@ -62,7 +62,7 @@
"rollup": "^2.77.2",
"typescript": "^4.7.4",
"wrangler": "^2.0.24",
"zx": "^7.0.7"
"zx": "^7.0.8"
},
"resolutions": {
"chalk@npm:^5.0.1": "^4.1.2"
Expand Down
Loading