0.2.1 • Published 4 months ago
ember-eslint v0.2.1
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 configutils.hasTypescript
- returns true when the host environment has typescriptutils.hasTypeModule
- returns true when the host environment hastype=module
in the package.jsonparsers.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