not-an-aardvark / eslint-plugin-self

Allows ESLint plugins to lint themselves
MIT License
18 stars 4 forks source link

Use the "main" field of package.json to locate self plugin #3

Closed meteorlxy closed 4 years ago

meteorlxy commented 4 years ago

https://github.com/not-an-aardvark/eslint-plugin-self/blob/7992f65654a1f3a3747aae0a0fcba626b358b803/index.js#L3

It's better to require plugin from "main" of package.json.

Something like:

const pkg = require('../../package.json');
const plugin = require(path.resolve(__dirname, '../..', pkg.main))
not-an-aardvark commented 4 years ago

Does the current behavior cause problems in practice? I think loading a directory automatically has the effect of resolving the main field of package.json.

meteorlxy commented 4 years ago

Uh you are right. Something could have gone wrong at the time 😅