Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Error: ENOENT: no such file or directory, scandir './rules' #106

Open
grappler opened this issue Jul 23, 2017 · 11 comments
Open

Error: ENOENT: no such file or directory, scandir './rules' #106

grappler opened this issue Jul 23, 2017 · 11 comments

Comments

@grappler
Copy link

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 eslint/generator-eslint#20

@grappler
Copy link
Author

@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

@grappler
Copy link
Author

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?

@ntwb
Copy link
Member

ntwb commented Jul 24, 2017

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.

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 :)

@ntwb
Copy link
Member

ntwb commented Jul 24, 2017

I also just checked that the proposal for _s in Automattic/_s#1159 uses eslint-config-wordpress 👍

@grappler
Copy link
Author

@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

@ntwb
Copy link
Member

ntwb commented Jul 24, 2017

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 WordPress-Coding-Standards/eslint-config-wordpress#8

@feryardiant
Copy link

Me just experiencing same issue & noticed that it still v0.1.0 on npm?

image

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

@ntwb
Copy link
Member

ntwb commented May 22, 2018

@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.

@feryardiant
Copy link

@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:

image

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?

@ntwb
Copy link
Member

ntwb commented May 22, 2018

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.

@feryardiant
Copy link

I see, thanks for the explanation @ntwb. Sure thing, will do.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants