ember-eslint

0.2.1 • Public • Published

ember-eslint

The easiest way to get linting going in in your ember project

Setup

install from npm:

npm add ember-eslint eslint

or, from source (by editing your package.json):

"devDependencies": {
  "ember-eslint": "github:NullVoxPopuli/ember-eslint"
}

In eslint.config.mjs,

import { ember } from 'ember-eslint';

export default [
    ...ember.recommended(import.meta.dirname),
];

In package.json:

"scripts": {
    "lint:js": "eslint .",
    "lint:js:fix": "eslint . --fix"
}

And that's it!

The configs

All configs will "do the right thing" when they detect that you're using (or not using) TypeScript, V2 (Vite) projects, etc

recommended aka "official"

This config mirrors the lint config that is specified in ember-cli, and where any significant change has a Request For Comments.

import { ember } from 'ember-eslint';

export default [
    ...ember.recommended(import.meta.dirname),
];

Support Matrix

This config supports a 2x2x2 matrix of features:

  • TypeScript vs JavaScript
  • App vs Addon
  • type=module packages and classic packages

Exported utilities

  • utils.hasBabelConfig - returns true when the host environment has a babel config
  • utils.hasTypescript - returns true when the host environment has typescript
  • utils.hasTypeModule - returns true when the host environment has type=module in the package.json
  • parsers.esm - the parser options for JS (babel) and TS ESM files

Debugging ESLint

Docs: https://eslint.org/docs/latest/use/configure/debug

Print a file's calculated configuration

npx eslint --print-config path/to/file.js

Inspecting the config

npx eslint --inspect-config

Readme

Keywords

Package Sidebar

Install

npm i ember-eslint

Weekly Downloads

437

Version

0.2.1

License

MIT

Unpacked Size

8.1 kB

Total Files

6

Last publish

Collaborators

  • nullvoxpopuli