not-an-aardvark / eslint-plugin-self Goto Github PK
View Code? Open in Web Editor NEWAllows ESLint plugins to lint themselves
License: MIT License
Allows ESLint plugins to lint themselves
License: MIT License
When attempting to use this plugin with a v9 compatible add-on, a message such as this is produced:
TypeError: Failed to load plugin 'self' declared in '--config': enabledPluginName.replace is not a function
at /Users/mark/dev/eslint-plugin-json/node_modules/eslint-plugin-self/index.js:38:53
at Array.map (<anonymous>)
at /Users/mark/dev/eslint-plugin-json/node_modules/eslint-plugin-self/index.js:38:10
at Array.forEach (<anonymous>)
at Object.<anonymous> (/Users/mark/dev/eslint-plugin-json/node_modules/eslint-plugin-self/index.js:29:31)
at Module._compile (/Users/mark/dev/eslint-plugin-json/test/packages/eslint-v7/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
The new configuration format allows for a combination of:
{
"configs": {
"recommended-legacy": {
"plugins": ["json"],
"rules": {
"json/*": "error",
},
},
"recommended": {
"plugins": { // object that refers to the plugin itself }
"rules": {
"json/*": "error",
},
}
}
so this needs to be handled in some manner.
Thanks for making this module ❤️ it's SUPER COOL.
We have our own "shared config" eslint plugin that we use to ensure code standards.
It uses several plugins, like eslint-plugin-node and eslint-plugin-mocha to expose a bunch of really useful rules.
So that every library that uses our eslint plugin doesn't have to also directly require those plugins, we export the plugins with prefixes as per this eslint issue.
Recently when I added a new global rule deprecating a module using eslint-plugin-node's "no-restricted-require" I got a bunch of errors because our existing method of linting ourself didn't get those prefixes.
Installed this module and it automatically just works.
Lifesaver!
I'll insta close this as I don't want anything, just wanted to say thank you and share how this is being used somewhere ❤️
Line 3 in 7992f65
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))
Hi there - I'm trying to use this project in a repo that uses pnpm rather than yarn/npm. pnpm installs packages differently so the assumption that ../..
will find the correct module breaks down. In my case, the installed is located at /path/to/my/project/node_modules/.pnpm/[email protected]/node_modules/eslint-plugin-self/index.js
.
Looks like #4 would likely fix.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.