blu*_*ers 10 javascript node.js typescript eslint
我的插件
@bluelovers/eslint-plugin https://github.com/bluelovers/ws-node-bluelovers/tree/master/packages/eslint-plugin
我的基本配置 https://github.com/bluelovers/ws-node-bluelovers/blob/master/packages/eslintrc/.eslintrc.json
运行时用户配置
{
"extends": [
"bluelovers"
]
}
Run Code Online (Sandbox Code Playgroud)
我可以输入用户仓库
eslint --print-config .
Run Code Online (Sandbox Code Playgroud)
这可以显示配置并且没有错误,我还在列表中看到了我的插件配置
"@bluelovers/no-irregular-whitespace": [
"error",
{
"skipComments": true,
"skipStrings": false,
"skipTemplates": false,
"skipRegExps": false,
"ignores": [
"?"
]
}
],
Run Code Online (Sandbox Code Playgroud)
但是当我输入时eslint index.ts,它显示错误
1:1 error Definition for rule '@bluelovers/no-irregular-whitespace' was not found @bluelovers/no-irregular-whitespace
Run Code Online (Sandbox Code Playgroud)
索引.ts
export const r = /[ \t\uFEFF\xA0?]+$/;
const IRREGULAR_WHITESPACE = /[\f\v ?????????????????]+/mgu;
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题??
Pla*_*ure 11
我认为关键的缺失部分是配置中没有“插件”部分。
你为什么从“bluelovers”延伸出来?您有发布共享配置吗?看起来你正在开发一个插件,而不是一个配置。
然后,您使用规则“@bluelovers/no-irregular-whitespace”,并以@开头。
如果您的插件发布为“@bluelovers/eslint-plugin”,您应该尝试如下操作:
{
"plugins": ["@bluelovers"],
"extends": ["@bluelovers"], // Assuming you have @bluelovers/eslint-config published, otherwise this might look different or could be skipped
"rules": {
"@bluelovers/no-irregular-whitespace": ["error"]
}
}
Run Code Online (Sandbox Code Playgroud)
这意味着 eslint 无法在您的index.js. 尝试查看您的index.js-exports。它们应该看起来像这样:
module.exports = {
rules: {
[myRuleName]: myRule
}
};
Run Code Online (Sandbox Code Playgroud)
而不是这样的:
exports.default = {
rules: {
[myRuleName]: myRule
}
};
Run Code Online (Sandbox Code Playgroud)
如果您使用的是 TypeScript,请将导出index.ts从更改export default {...}为export = {...}。
| 归档时间: |
|
| 查看次数: |
14112 次 |
| 最近记录: |