admin管理员组文章数量:1181449
my plugin
@bluelovers/eslint-plugin
my base config /.eslintrc.json
runtime user config
{
"extends": [
"bluelovers"
]
}
i can type in user repo
eslint --print-config .
this can show config and didn't error, i also see my plugin config inside the list
"@bluelovers/no-irregular-whitespace": [
"error",
{
"skipComments": true,
"skipStrings": false,
"skipTemplates": false,
"skipRegExps": false,
"ignores": [
" "
]
}
],
but when i type eslint index.ts
, it show error
1:1 error Definition for rule '@bluelovers/no-irregular-whitespace' was not found @bluelovers/no-irregular-whitespace
index.ts
export const r = /[ \t\uFEFF\xA0 ]+$/;
const IRREGULAR_WHITESPACE = /[\f\v ]+/mgu;
how can i fix this??
my plugin
@bluelovers/eslint-plugin https://github.com/bluelovers/ws-node-bluelovers/tree/master/packages/eslint-plugin
my base config https://github.com/bluelovers/ws-node-bluelovers/blob/master/packages/eslintrc/.eslintrc.json
runtime user config
{
"extends": [
"bluelovers"
]
}
i can type in user repo
eslint --print-config .
this can show config and didn't error, i also see my plugin config inside the list
"@bluelovers/no-irregular-whitespace": [
"error",
{
"skipComments": true,
"skipStrings": false,
"skipTemplates": false,
"skipRegExps": false,
"ignores": [
" "
]
}
],
but when i type eslint index.ts
, it show error
1:1 error Definition for rule '@bluelovers/no-irregular-whitespace' was not found @bluelovers/no-irregular-whitespace
index.ts
export const r = /[ \t\uFEFF\xA0 ]+$/;
const IRREGULAR_WHITESPACE = /[\f\v ]+/mgu;
how can i fix this??
Share Improve this question edited Jun 1, 2019 at 9:08 R.J. Dunnill 2,0793 gold badges11 silver badges23 bronze badges asked Jun 1, 2019 at 5:31 blueloversbluelovers 1,2552 gold badges12 silver badges24 bronze badges 2- 12 At least in my case this was not a configuration issue and could be resolved by simply restarting VS Code. So before you start digging in the documentation of a dozen eslint plugins, you might want to give that a try. I'll just leave this here as a hint. – tillsanders Commented Jan 6, 2021 at 16:15
- 1 @bluelovers did you get an answer to this? I see that you have removed the eslintrc from your project. Im stuck on the same issue. – Ashwin Commented Sep 1, 2023 at 10:09
2 Answers
Reset to default 13I think the key missing piece is no "plugins" section in config.
Why are you extending from "bluelovers"? Do you have a shared config published? It seems like you're working on a plugin, not a config.
You're then using a rule "@bluelovers/no-irregular-whitespace", with a leading @.
If your plugin is published as "@bluelovers/eslint-plugin", you should try something like this:
{
"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"]
}
}
It means eslint cannot find rules in your index.js
. Try having a look at your index.js
-exports. They should look something like this:
module.exports = {
rules: {
[myRuleName]: myRule
}
};
And not like this:
exports.default = {
rules: {
[myRuleName]: myRule
}
};
If you're using TypeScript, change your export in index.ts
from export default {...}
to export = {...}
.
本文标签: javascripteslint why does my plugin show Definition for rule was not foundStack Overflow
版权声明:本文标题:javascript - eslint why does my plugin show Definition for rule was not found? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738186586a2067730.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论