根据文档,如果它们是名为“eslint-plugin-”的 npm 模块,插件应该可以工作
所以,我们做一个新项目
md foo
cd foo
npm init
... answer questions ..
npm install --save-dev eslint
npm install --save-dev eslint-plugin-require
echo "define(function(){});" > test.js
echo "{\"rules\":{\"require\": 2}}" > conf.json
node node_modules/eslint/bin/eslint.js -c conf.json --plugin eslint-plugin-require test.js
生产
~/node_modules/eslint/lib/eslint.js:569
throw new Error("Definition for rule '" + key + "' was not
^
Error: Definition for rule 'require' was not found.
将配置更改为
echo "{\"rules\":{\"eslint-plugin-require\": 2}}" > conf.json
也不
echo "{\"rules\":{\"require-define\": 2}}" > conf.json
也不
echo "{\"rules\":{\"require-require-define\": 2}}" > conf.json
也不
echo "{\"rules\":{\"eslint-plugin-require-define\": 2}}" > conf.json
也不
echo "{\"rules\":{\"eslint-plugin-require-require-define\": 2}}" > conf.json
不修复它
如何使用本地安装的 eslint 插件?