Improve the UX of using an npm installed formatter
See original GitHub issueThis is currently what you have to write to use a custom npm installed formatter with ESLint:
$ eslint --format=node_modules/eslint-formatter-unicorn file.js
That’s not very user-friendly.
I propose the following:
- Make
getFormatter()
try to require the formatter from cwd first. That way you could just do:
$ eslint --format=eslint-formatter-unicorn file.js
- Make it possible to omit the
eslint-formatter
prefix. This matches the convention for shareable configs. This combined with1.
would mean you could just do:
$ eslint --format=unicorn file.js
Much nicer! ✨
I would also document the recommendation of using the eslintformatter
keyword in package.json, like you do with shareable configs. This would make it easier for users to find third-party formatters.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:9 (9 by maintainers)
Top Results From Across the Web
precise-ui - npm
The following sections guide you through the process of developing Precise UI. Installation. For development you will need NPM and Node.js 8+.
Read more >Let's Build a Web App with NPM and Express - This Dot Labs
We'll be building a simple express application, so we want to install the express package from npm. This can be done by running...
Read more >Linting in TypeScript using ESLint and Prettier - LogRocket Blog
Integrate Prettier with ESLint to automate type-checking in your TypeScript code and ensure that the code has no bugs.
Read more >How to use Prettier with ESLint and TypeScript in VSCode
Decide on the formatting configuration that best suits your style; Configure Prettier to work with ESLint. Prerequisites. A code editor ...
Read more >What is NPM? The Complete 2023 Beginner's Guide
The package.json file is in JSON format and is used for managing the ... These are installed using npm install to add the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was wondering if we should instead add formatters to be distributed through plugins? Formatters are the only thing we currently have that we don’t have a recommended way of shearing.
This was added in https://github.com/eslint/eslint/pull/9464.