Error: ENOENT: no such file or directory, scandir './rules'
Package.json
"eslintConfig": {
"extends": "plugin:wordpress/recommended",
"plugins": [
"wordpress"
]
},
"eslintIgnore": [
"js/**.min.js"
],
When I run the eslint js/** on _s I get the following error.
Error: ENOENT: no such file or directory, scandir './rules'
at Error (native)
at Object.fs.readdirSync (fs.js:951:18)
at module.exports (/usr/local/lib/node_modules/eslint-plugin-wordpress/node_modules/requireindex/index.js:18:20)
at Object.<anonymous> (/usr/local/lib/node_modules/eslint-plugin-wordpress/index.js:20:24)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
Similar issue https://github.com/eslint/generator-eslint/pull/20
@ntwb I figured out the issue. The issue is that the version on NPM has not been updated. https://www.npmjs.com/package/eslint-plugin-wordpress
I ended up installing it via npm i -g https://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress
If I understand this correctly eslint-config-wordpress is what I should be using and eslint-plugin-wordpress is where it the rules are managed.
Would that mean the Readme file should be updated to recommend people to use eslint-config-wordpress?
If I understand this correctly
eslint-config-wordpressis what I should be using andeslint-plugin-wordpressis where it the rules are managed.
Yes, you should really only use eslint-config-wordpress and as I just noted on the _s's PR I'll be releasing a new version of eslint-config-wordpress in the next couple of days with some pretty big changes, waiting a couple of days before refactoring any code to match these rules would be my recommendation :)
Would that mean the Readme file should be updated to recommend people to use
eslint-config-wordpress?
Probably, yes :)
I also just checked that the proposal for _s in https://github.com/Automattic/_s/pull/1159 uses eslint-config-wordpress 👍
@ntwb Thanks, I did start looking at that but I got confused by the two repos as eslint-config-wordpress did not have all of the rules.
Are there different rulesets that we can use or does the WordPress ruleset include everything?
For example space-unary-ops is defined differently in stylistic-issues.js and jscs.js. Which one does get applied?
Or consistent-this in stylistic-issues.js. Why does it not create a warning for self = self.parentElement; in navigation.js#L72
These are the updates that are coming in the next releases...
Up until (and currently including now) eslint-config-wordpress has been a standalone _shared config, with the release of 3.0.0ofeslint-config-wordpressit will extendeslint-plug-wordpress` which will then bring some parity to the both repos.
See also https://github.com/WordPress-Coding-Standards/eslint-config-wordpress/issues/8
Me just experiencing same issue & noticed that it still v0.1.0 on npm?

I ended up installing it via
npm i -g https://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress
Is that's the only way to solve this issue? and when the latest version will available on npm?
Thanks
@feryardiant Unless you have got a specific requirement to use this package, you should use https://github.com/WordPress-Coding-Standards/eslint-config-wordpress instead of this package here.
@ntwb
Unless you have got a specific requirement to use this package
What's that mean? Is that mean you wanna say that "We don't have plan to publish latest version on npm for some reason" ??
Actually actually it's my first time trying to use all wordpress coding standards instead of just wpcs package but also eslint-config-wordress and stylelint-config-wordress. But I noticed some inconsistency and odd standards on the eslint-config-wordress package, somehow. For instance:

It's ask me to write
(function( document ) {
// some codes
}( document ));
instead of
(function( document ) {
// some codes
})( document );
Note: I'm not going to linting full project just yet.
Anyway, could you please explain further about the "specific requirement" means?
Sure, @feryardiant, eslint-plugin-wordpress is currently undergoing lots of frequent changes and at the moment it also includes some bugs. There are no plans to publish any updates of this package to npmjs.com until some new coding standards changes are implemented upstream from WordPress Core and Gutenberg that fixes the bugs. Then we will look to releasing an update of eslint-plugin-wordpress to npmjs.com.
This is why I recommended using eslint-config-wordpress, seeing as though you have an issue with the wrap-iife rule you can turn that rule off in your local config. Also would you mind creating an issue at https://github.com/WordPress-Coding-Standards/eslint-config-wordpress/issues/new so we can investigate further if we should turn this rule off by default please.
I see, thanks for the explanation @ntwb. Sure thing, will do.