npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-plugin-mmkal

v0.7.0

Published

My eslint plugin with rules I find good. If you aren't me you probably shouldn't use this.

Downloads

1,352

Readme

eslint-plugin-mmkal

My eslint plugin with rules I find good. If you aren't me, or don't know me, you probably shouldn't use this.

Goals

  1. Work out of the box
  2. Cover as many js/ts development use-cases as possible
  3. Be prescriptive about arbitrary rules like formatting
  4. Enforce some degree of consistency
  5. Be opinionated but trusting
  6. Protect against common gotchas
  7. Provide pits of success
  8. Don't require any peer dependencies to work
  9. Be somewhat configurable

Included

The following plugins/libraries are usable and should "just work" without needing to add extra configs.

  1. prettier
  2. typescript-eslint
  3. embedded js/ts in markdown
  4. eslint-plugin-codegen
  5. eslint-plugin-unicorn
  6. eslint-plugin-import
  7. eslint-plugin-vitest
  8. eslint-plugin-promise
  9. @rushstack/eslint-plugin-packlets
  10. eslint-plugin-react
  11. eslint-plugin-react-hooks
  12. @next/eslint-plugin-next
  13. eslint-plugin-jsx-a11y

There's some effort to make sure the rules only aplly to relevant files, but of course there are many different possible projedt setups.

Not enabled currently but may be soon:

  1. eslint-plugin-functional

Non-goals

  1. Small package size
  2. Support non-flat config
  3. Be your mother

How to use

Install with npm install eslint-plugin-mmkal --save-dev, then in your eslint.config.js:

module.exports = require('eslint-plugin-mmkal').recommendedFlatConfigs

Notes

Prettier is pre-configured

That is, there are prettier options baked into this package, and the above usage will use them. If you want to rely on the default prettier resolution, just override:

const mmkal = require('eslint-plugin-mmkal')

module.exports = [
  ...mmkal.recommendedFlatConfigs,
  {rules: {'prettier/prettier': 'warn'}},
]

This will rely on prettier's built-in config resolution. The reason this package doesn't do this is so that you can install it in a project without a .prettierrc.js file, and you get what I think is a better prettier config than the default.

Common globals are enabled

Because the goal of this plugin is to make it quick to write sensible code rather than be 100% sure to prevent you from writing silly code (which no lint library can really achieve), globals for nodejs, browsers, commonjs and es2021 are enabled by default. Use typescript to get compiler errors on undefined globals.

All of the globals in the globals package (which are the official globals eslint uses) are available as configs:

const mmkal = require('eslint-plugin-mmkal')

module.exports = [
  ...mmkal.recommendedFlatConfigs,
  ...mmkal.configs.globals_greasemonkey,
]

🧪 Disabling configs

This is somewhat experimental and might be changed, but there's a jerry-rigged "naming" system that ships with this package to make it easier to disable internal configs (which are pretty modular) if you don't want it:

const mmkal = require('eslint-plugin-mmkal')

module.exports = mmkal.withoutConfigs(mmkal.recommendedFlatConfigs, [
  'globals_node',
  'prettierPreset',
])

Since this is experimental and subject to change, what the actual names are isn't documented here, but the withoutConfigs function is strongly typed, so IDE intellisense/autocomplete should hint what you can disable.

Some rules are shimmed

There's a rule added to the prettier plugin, prettier/processed. This is the same as the prettier/prettier rule but it shims context.physicalFilename with context.filename - because the builtin prettier rule refuses to lint javascript embedded within a markdown file, thinking that the whole markdown file will be linted. There's a similar shim with unicorn/filename-case.