Giter Site home page Giter Site logo

fabric's Introduction

umi-fabric

一个包含 prettier,eslint,stylelint 的配置文件合集

A collection of configuration files containing prettier, eslint, stylelint

Use

安装

npm i @umijs/fabric --save-dev
yarn add @umijs/fabric -D

in .eslintrc.js

module.exports = {
  extends: [require.resolve('@umijs/fabric/dist/eslint')],

  // in antd-design-pro
  globals: {
    ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
    page: true,
  },

  rules: {
    // your rules
  },
};

in .stylelintrc.js

module.exports = {
  extends: [require.resolve('@umijs/fabric/dist/stylelint')],
  rules: {
    // your rules
  },
};

in .prettierrc.js

const fabric = require('@umijs/fabric');

module.exports = {
  ...fabric.prettier,
};

fabric's People

Contributors

afc163 avatar atzcl avatar chenshuai2144 avatar duanledexianxianxian avatar fengyuchenglun avatar guxiaobai avatar han-meim avatar hanzebang avatar inori-lover avatar jiyingzhi avatar kaier33 avatar linxiangjun avatar lsnsh avatar lubyxu avatar pines-cheng avatar renderz avatar superhuangxu avatar ttys026 avatar xiaohuoni avatar xz8la8 avatar yoyo837 avatar yuaanlin avatar yunsii avatar z-hnan avatar zombiej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fabric's Issues

"import/no-cycle" is invalid: Value "∞" should be integer

yarn run v1.22.10
$ eslint "src/**/*.{ts,tsx,js,jsx}"

Oops! Something went wrong! :(

ESLint: 7.31.0

Error: .eslintrc.js » /Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/@umijs/fabric/dist/eslint.js » eslint-config-airbnb-base » /Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/eslint-config-airbnb-base/rules/imports.js:
        Configuration for rule "import/no-cycle" is invalid:
        Value "∞" should be integer.

    at ConfigValidator.validateRuleOptions (/Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/@eslint/eslintrc/lib/shared/config-validator.js:144:23)
    at /Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/@eslint/eslintrc/lib/shared/config-validator.js:199:18
    at Array.forEach (<anonymous>)
    at ConfigValidator.validateRules (/Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/@eslint/eslintrc/lib/shared/config-validator.js:196:34)
    at ConfigValidator.validateConfigArray (/Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/@eslint/eslintrc/lib/shared/config-validator.js:322:18)
    at CascadingConfigArrayFactory._finalizeConfigArray (/Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:493:23)
    at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:299:21)
    at FileEnumerator._iterateFilesRecursive (/Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/eslint/lib/cli-engine/file-enumerator.js:445:49)
    at _iterateFilesRecursive.next (<anonymous>)
    at FileEnumerator.iterateFiles (/Users/zhihu/zhihu.com/fe/ad-taskbiz-web/node_modules/eslint/lib/cli-engine/file-enumerator.js:296:49)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

为什么引用fabric总会提示缺少依赖?

比如缺少prettier extend,lint报错,需要在自己的项目里安装比如stylelint-config-standard这样的包才可以解决,按理说本项目里的依赖会自动载入啊,node_modules也包含这些依赖,但是跑lint-stage就会包缺少依赖的报错

Linting not complete anymore

Hi,
I was wondering if it is on purpose that the airbnb linting doesn't work properly anymore. So for example the rules for usage of quotes, spaces for curly braces etc. don't work anymore.
When I try to add them to the extends list there are problems with import '@/...' statements again.

How can this be resolved?

Best,
Nico

正在从"'eslint'"中获取代码操作

image
保存了就这样,然后,过了几秒钟就好了。个人猜测是不是这里面哪里卡主了。我发现我的其他项目没有这个问题。其他项目没有用到这个。

@typescript-eslint/no-use-before-define 不知道为什么失效了

@umijs/fabric版本是2.4.9

image

.eslintrc.js配置如下

image

不管是使用@umijs/fabric默认配置,还是自己定义@typescript-eslint/no-use-before-define都无效

image

mac os: 10.13.6
node: 12.11.0
yarn: 1.13.0
react: 16.13.1
typescript: 4.0.2

我该如何处理这个问题,百忙之中辛苦看一下,谢谢 😊

Unexpected character '@' 语法无法识别

.\src\pages\login\index.jsx
11:1 error Parsing error: Unexpected character '@'

✖ 1 problem (1 error, 0 warnings)


 @connect(({ dispatch, userLogin }) => ({
 dispatch,
 userLogin
})) 
class Index extends PureComponent {}

将@umijs/fabric放在devDependencies,通过npm或者yarn安装后IDE报错无法使用

Error: Failed to load plugin 'eslint-comments' declared in '.eslintrc.js » D:\projects\my-project\node_modules\@umijs\fabric\dist\eslint.js': Cannot find module 'eslint-plugin-eslint-comments'
Require stack:
- D:\projects\my-project\__placeholder__.js

Error: Failed to load plugin 'eslint-comments' declared in '.eslintrc.js » D:\projects\my-project\node_modules\@umijs\fabric\dist\eslint.js': Cannot find module 'eslint-plugin-eslint-comments'
Require stack:
- D:\projects\my-project\__placeholder__.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.resolve (internal/modules/cjs/helpers.js:80:19)
    at Object.resolve (D:\projects\my-project\node_modules\eslint\lib\shared\relative-module-resolver.js:40:50)
    at ConfigArrayFactory._loadPlugin (D:\projects\my-project\node_modules\eslint\lib\cli-engine\config-array-factory.js:1010:39)
    at D:\projects\my-project\node_modules\eslint\lib\cli-engine\config-array-factory.js:901:33
    at Array.reduce (<anonymous>)
    at ConfigArrayFactory._loadPlugins (D:\projects\my-project\node_modules\eslint\lib\cli-engine\config-array-factory.js:897:22)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (D:\projects\my-project\node_modules\eslint\lib\cli-engine\config-array-factory.js:720:44)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (D:\projects\my-project\node_modules\eslint\lib\cli-engine\config-array-factory.js:660:20)

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.

更新之后出现错误:

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: .eslintrc.js.
The file must be included in at least one of the projects provided.

eslintrc.js

module.exports = {
  extends: [require.resolve('@umijs/fabric/dist/eslint')],

  globals: {},

  rules: {
    /* js */
    // 代码格式用prettier
    quotes: 'off',
    indent: 'off',
    // 会误伤@
    'import/no-unresolved': 'off',
    
    'no-console': 'off',
    
    'no-unused-expressions': 'off',
    // 必须要new
    'no-new': 'off',
    // 有时候需要声明局部变量
    'no-underscore-dangle': 'off',
    // 可以避免声明多余的变量
    'no-param-reassign': 'off',
    // 返回值有可能是联合类型
    'consistent-return': 'off',
    // 简化书写, 保证用 () 包裹即可
    'no-return-assign': 'off',
    // 这个要有
    'no-plusplus': 'off',
    // 很多时候会在文本中放emoji
    'jsx-a11y/accessible-emoji': 'off',
    // ts

    /* react */
    // 有时候需要使用dangerouslySetInnerHTML
    'react/no-danger': 'off',
    // 在没有id时只能使用index
    'react/no-array-index-key': 'off',

    // 其他

    'eslint-comments/no-unlimited-disable': 'off',
  },
};

依赖了 @typescript-eslint/[email protected] 但是这个 @typescript-eslint/typescript-estree 没发上去

Error: [@alipay/[email protected] › @alipay/[email protected] › @alipay/[email protected] › @umijs/[email protected] › @typescript-eslint/[email protected] › @typescript-eslint/[email protected]+f9a9fbfc] Can't find package @typescript-eslint/typescript-estree's version: 2.11.1-alpha.2
at resolve (/opt/taobao/nvm/versions/node/v10.16.0/lib/node_modules/tnpm/node_modules/_npminstall@3.23.0@npminstall/lib/download/npm.js:98:11)
at resolve.next ()
at onFulfilled (/opt/taobao/nvm/versions/node/v10.16.0/lib/node_modules/tnpm/node_modules/_co@4.6.0@co/index.js:65:19)
at process._tickCallback (internal/process/next_tick.js:68:7)

升级到2.2.2后,执行eslint特别慢

升级到2.2.2后,执行eslint就变得特别慢,打开debug后看到,每次loading package.json要花3s以上,processing 一个tsx文件也要4s以上,整个项目执行下来十几分钟都还没结束
image

不知是不是跟这个版本增加了tsconfig.json的读取有关

定义的prettier和eslint规则冲突

关于 space-before-function-paren

export default function(args) {
}

prettier会自动把function后面的空格清除
提交的时候,eslint又提示space-before-function-paren错误。

"scripts": {
    "prettier": "prettier -c --write **/*",
    "eslint": "eslint --ext .js,.jsx,.ts,.tsx --format=pretty ./",
    "lint-staged": "lint-staged"
  },
"husky": {
    "hooks": {
      "pre-commit": "npm run lint-staged"
    }
  },
  "lint-staged": {
    "**/*.{js,jsx,tsx,ts,less,md,json}": [
      "npm run prettier",
      "git add"
    ],
    "**/*.{js,jsx,ts,tsx}": "npm run eslint"
  },

.prettierrc.js

const fabric = require('@umijs/fabric');

module.exports = {
  ...fabric.prettier,
};

.eslintrc.js

const fabric = require('@umijs/fabric');

module.exports = {
  ...fabric.default,
  rules: {
    ...fabric.default.rules,
    '@typescript-eslint/camelcase': 0,
    '@typescript-eslint/class-name-casing': 0
  },
  globals: {
    page: true,
  },
};

不支持 js 吗?

一直使用 js 都没问题,今天提交突然就报错,不识别 jsx 语法,也不识别 ?.、?? 等这种新语法,貌似缺少了这种配置

ecmaFeatures: {
  jsx: true,
},

没有使用 babel-eslint 导致不识别新语法,不知道是不是间接依赖更新导致的。

vscode格式化less文件,无法正常使用

项目结构

image

版本信息

  • "@umijs/fabric": "^2.5.10",
  • "prettier": "^2.2.1"
  • Prettier Formatter for Visual Studio Code,v6.3.2,vscode插件

less文件代码

// 111111
.span {
  color: red;
}

// 有注释可能就报错

复现流程

我把项目依赖最小化,最后分析出这这两个包和插件导致格式化文件出错。

  1. 安装项目依赖,重启vscode
  2. 手动格式化单个文件less文件,使用Prettier插件
  3. 只有三个文件同时存在的时候才回出现这种问题

image

更新后如果没用ts的项目如何配置?

之前用的早期版本的antd-pro,javascript的语言,更新后,执行lint出现提示

Cannot read file /xxx/tsconfig.json. 

转了一圈,似乎是这里有个配置项

parserOptions: {
    project: './tsconfig.json',
},

这个应该如何配置

Configuration for rule "import/no-cycle" is invalid:

version 2.1.1

$ eslint --ext .js,jsx,ts,tsx packages/**/src --fix

Oops! Something went wrong! :(

ESLint: 7.3.0

Error: .eslintrc.js » /node_modules/@umijs/fabric/dist/eslint.js » /node_modules/@umijs/fabric/node_modules/eslint-config-airbnb/index.js » /node_modules/@umijs/fabric/node_modules/eslint-config-airbnb/node_modules/eslint-config-airbnb-base/index.js » /node_modules/@umijs/fabric/node_modules/eslint-config-airbnb/node_modules/eslint-config-airbnb-base/rules/imports.js:
Configuration for rule "import/no-cycle" is invalid:
Value null should be integer.

Configuration for rule "import/no-cycle" is invalid: Value null should be integer.

This is indeed a bug in eslint v7.3.0; downgrade to v7.2 for now.

eslint-issue

ESLint 7.3.0 has some issue here, but when I downgrade to v7.2

It will cause another issue, first it will @types-eslint issue, I install it then it will cause

ESLint couldn't find the plugin "eslint-plugin-eslint-comments".

(The package "eslint-plugin-eslint-comments" was not found when loaded as a Node module from the directory "/Users/crh/Project/za-prudential-thai".)

Then it will cause another issue...

I think maybe we can stay in a stable version first.

build时报错

renderz@renderzdeMacBook-Pro fabric % yarn build
yarn run v1.6.0
(node:4275) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ tsc
node_modules/@types/vfile/index.d.ts:11:31 - error TS7016: Could not find a declaration file for module 'vfile-message'. '/Users/renderz/github/fabric/node_modules/vfile-message/index.js' implicitly has an 'any' type.
Try npm install @types/vfile-message if it exists or add a new declaration (.d.ts) file containing declare module 'vfile-message';

11 import * as vfileMessage from 'vfile-message';
~~~~~~~~~~~~~~~

Found 1 error.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

posibility of a 2.6.3 release with less strict eslint-plugin-markdown version dependency

Hi, @chenshuai2144,

Issue Description

I noticed that a vulnerability is introduced in @umijs/[email protected]:
Vulnerability CVE-2020-7753 (high severity) affects package trim (versions:<0.0.3): https://snyk.io/vuln/SNYK-JS-TRIM-1017038
The above vulnerable package is referenced by @umijs/[email protected] via:
@umijs/[email protected][email protected][email protected][email protected]

Since @umijs/[email protected] (12,820 downloads per week) is referenced by 55 downstream projects (e.g., sylvanas 0.6.1 (latest version), @ant-design/pro-cli 2.1.5 (latest version), @umijs/block-sdk 2.3.0 (latest version), @ant-design/bisheng-plugin 2.3.1 (latest version), @umijs/preset-ui 2.2.9 (latest version)), the vulnerability CVE-2020-7753 can be propagated into these downstream projects and expose security threats to them via the following package dependency paths:
(1)@ant-design/[email protected][email protected] ➔ @umijs/[email protected][email protected][email protected][email protected]
(2)@umijs/[email protected][email protected] ➔ @umijs/[email protected][email protected][email protected][email protected]
......

If @umijs/[email protected].* removes the vulnerable package from the above version, then its fixed version can help downstream users decrease their pain.

Given the large number of downstream users, could you help update your package to remove the vulnerability from @umijs/[email protected]* ?

Fixing suggestions

In @umijs/[email protected], you can kindly perform the following upgrade :
eslint-plugin-markdown ^1.0.0 ➔ ^2.2.0;

Note:
[email protected](>=2.2.0) doesn’t depends on trim any more.
Of course, you are welcome to share other ways to resolve the issue.

Thank you for your attention to this issue.

Can not prettier format .less file in VSCode

Summary

prettier-plugin-style-order 依赖 prettier v1.19.1, 但是 VSCode prettier 依赖 prettier ^2. 不兼容.

经过测试,只要把 prettier-plugin-style-order 中的 prettier 升级到 ^2 就能正常运行.

但是,prettier-plugin-style-order 的仓库跟npm 版本都对不上... 我觉得它可能不怎么维护了?所以把 issues 提到了这里。

Github Repository to Reproduce Issue

// @import '~antd/dist/antd.less';  

.bg {
  height: 100vh;
  overflow: hidden;
  background: url(../assets/bg.jpg) no-repeat;
  background-size: cover;
}
// @import './ScienceLayoutTheme.less';
// https://pro.ant.design/docs/style-cn#%E8%A6%86%E7%9B%96%E7%BB%84%E4%BB%B6%E6%A0%B7%E5%BC%8F
:global {
  .ant-card {
    background: transparent !important;border-width: 1px;
  border-color: rgb(127, 183, 255);
  border-style: solid;
  border-radius: 6px;
  background-color: rgba(127, 183, 255, 0.078);
  box-shadow: inset 0px 0px 16px 4px rgba(127, 183, 255, 0.45);
  }
}

Additional information

Prettier VSCode 6.4.0
VSCode:
Version: 1.56.0 (user setup)
Commit: cfa2e218100323074ac1948c885448fdf4de2a7f
Date: 2021-05-04T22:09:06.405Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.19042

Prettier Log Output

["INFO" - 下午3:39:17] Extension Name: esbenp.prettier-vscode.
["INFO" - 下午3:39:17] Extension Version: 6.4.0.
["INFO" - 下午3:39:20] Formatting c:\lcysgsg\code\github\prettier-plugin-style-order\ScienceLayout.less
["INFO" - 下午3:39:20] Using config file at 'c:\lcysgsg\code\github\prettier-plugin-style-order\prettier.config.js'
["INFO" - 下午3:39:20] Using ignore file (if present) at c:\lcysgsg\code\github\prettier-plugin-style-order\.prettierignore
["INFO" - 下午3:39:20] File Info:
{
  "ignored": false,
  "inferredParser": "less"
}
["INFO" - 下午3:39:20] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 下午3:39:20] Prettier Options:
{
  "filepath": "c:\\lcysgsg\\code\\github\\prettier-plugin-style-order\\ScienceLayout.less",
  "parser": "less",
  "printWidth": 80,
  "semi": false,
  "singleQuote": true,
  "trailingComma": "all",
  "plugins": ["c:\\lcysgsg\\code\\github\\prettier-plugin-style-order"]
}
["ERROR" - 下午3:39:20] Error formatting document.

CssSyntaxError: <css input>:10:1: Unknown word
	at Input.error (c:\Users\lcysgsg\code\Management\node_modules\postcss\lib\input.js:128:16)
	at Parser.unknownWord (c:\Users\lcysgsg\code\Management\node_modules\postcss\lib\parser.js:561:22)
	at Parser.other (c:\Users\lcysgsg\code\Management\node_modules\postcss\lib\parser.js:166:12)
	at Parser.parse (c:\Users\lcysgsg\code\Management\node_modules\postcss\lib\parser.js:75:16)
	at parse (c:\Users\lcysgsg\code\Management\node_modules\postcss\lib\parse.js:17:12)
	at new LazyResult (c:\Users\lcysgsg\code\Management\node_modules\postcss\lib\lazy-result.js:64:16)
	at Processor.<anonymous> (c:\Users\lcysgsg\code\Management\node_modules\postcss\lib\processor.js:142:12)
	at Processor.process (c:\Users\lcysgsg\code\Management\node_modules\postcss\lib\processor.js:121:23)
	at module.exports (c:\Users\lcysgsg\code\Management\node_modules\prettier-plugin-style-order\src\config\sorter.js:8:6)
	at Object.preprocess (c:\Users\lcysgsg\code\Management\node_modules\prettier-plugin-style-order\src\index.js:40:18)
	at Object.parse (c:\Users\lcysgsg\code\Management\node_modules\prettier\index.js:13620:21)
	at coreFormat (c:\Users\lcysgsg\code\Management\node_modules\prettier\index.js:14899:14)
	at format (c:\Users\lcysgsg\code\Management\node_modules\prettier\index.js:15131:14)
	at c:\Users\lcysgsg\code\Management\node_modules\prettier\index.js:57542:12
	at Object.format (c:\Users\lcysgsg\code\Management\node_modules\prettier\index.js:57562:12)
	at t.default.<anonymous> (c:\Users\lcysgsg\.vscode\extensions\esbenp.prettier-vscode-6.3.2\dist\extension.js:1:16897)
	at Generator.next (<anonymous>)
	at s (c:\Users\lcysgsg\.vscode\extensions\esbenp.prettier-vscode-6.3.2\dist\extension.js:1:9119)

stylelint 错误

Error: ENOENT: no such file or directory, open 'd:\Work\Project\abp\WtFoundation.Membership\react\membership-platform-admin\node_modules@umijs\fabric\node_modules\stylelint-config-standard\index.js'
image

使用 @typescript-eslint/naming-convention 提交代码报错

husky > pre-commit (node v10.21.0)
✔ Preparing...
⚠ Running tasks...
  ❯ Running tasks for *.{ts,tsx,js,jsx}
    ✖ eslint --fix [FAILED]
    ◼ prettier --write
  ↓ No staged files match .{less,css,json} [SKIPPED]
↓ Skipped because of errors from tasks. [SKIPPED]
✔ Reverting to original state because of errors...
✔ Cleaning up... 

✖ eslint --fix:

/Users/crazyair/demo/.eslintrc.js
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: .eslintrc.js.
The file must be included in at least one of the projects provided

.eslintrc.js

module.exports = {
  plugins: ['react-hooks'],
  extends: [require.resolve('@umijs/fabric/dist/eslint')],
  rules: {
    'react-hooks/rules-of-hooks': 'error', // 检查 Hook 的规则
    'react-hooks/exhaustive-deps': 'error', // 检查 effect 的依赖
    'import/no-unresolved': 0,
    'no-underscore-dangle': 0,
    'import/no-extraneous-dependencies': 0,
    'global-require': 0,
    'import/no-dynamic-require': 0,
    'react/sort-comp': 0,
    'jsx-a11y/aria-role': 0,
    'no-void': 0,
    'no-param-reassign': 0,
    'no-control-regex': 0,
    'no-plusplus': 0,
    'consistent-return': 0,
    'no-template-curly-in-string': 0,
    'prefer-promise-reject-errors': 0,
    'no-lonely-if': 0,
    'no-shadow': 0,
    'no-console': 0,
    '@typescript-eslint/naming-convention': 0,
  },
};

Failed to load plugin 'unicorn' declared in '.eslintrc.js at /@umijs/fabric/dist/eslint.js'

在使用git cz提交代码时,报下列错误:

SyntaxError: Failed to load plugin 'unicorn' declared in '.eslintrc.js » /Users/xxx/node_modules/@umijs/fabric/dist/eslint.js': Invalid regular expression: /(?<before>(?:^|[^\\])(?:\\\\)*)\\(?<data>x[\da-f]{2}|u[\da-f]{4}|u{[\da-f]+})/: Invalid group
at Object.<anonymous> (/Users/xxx/node_modules/eslint-plugin-unicorn/rules/escape-case.js:10:29)
at Module._compile (/Users/xxx/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (/xxx/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at module.exports (/xxx/node_modules/import-modules/index.js:47:29)
at Object.<anonymous> (/xxx/node_modules/eslint-plugin-unicorn/index.js:6:9)

自己已尝试删除依赖并重新安装,但是无果。

eslint 对于 ts 有个规则不起作用

引用头的顺序规则:node_modules 的包顺序在上面,项目中的文件排在下面。

在 ts 中可以自定义相对路径比如 @/ 开头,eslint 误认为它是 node_modules 包,骗过了顺序校验,比如这样:

import PageBlock from '@/containers/PageBlock';
import { useIntl } from 'umi';

有什么好的方案解决吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.