0.0.1 • Published 2 years ago

@dhmk/eslint-plugin-atom v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Eslint plugin for linting @dhmk/atom.

Right now, it has one rule which detects missing (). This mostly happens while checking some conditions or accessing .length property on array atom.

Some examples:

const a = atom(true);

// should be a()
if (a) console.log("true");

const b = atom([1, 2, 3]);

// should be b().length
// since functions also have .length property, typescript won't detect an error
console.log("array length: ", b.length);

Install

npm install -D @typescript-eslint/parser @dhmk/eslint-plugin-atom

Next, activate it in your .eslintrc.js file:

module.exports = {
  root: true,
  parser: "@typescript-eslint/parser",
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: "tsconfig.json",
  },
  plugins: ["@dmhk/atom"],
  rules: {
    "@dhmk/atom/missing-call": "warn",
  },
};

See typescript-eslint docs for more help.