122 lines
2.2 KiB
JavaScript
122 lines
2.2 KiB
JavaScript
/**
|
|
* Debugging:
|
|
* 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
|
|
*
|
|
*/
|
|
import globals from 'globals';
|
|
import js from '@eslint/js';
|
|
|
|
import ember from 'eslint-plugin-ember/recommended';
|
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
import qunit from 'eslint-plugin-qunit';
|
|
import n from 'eslint-plugin-n';
|
|
|
|
import babelParser from '@babel/eslint-parser/experimental-worker';
|
|
|
|
const esmParserOptions = {
|
|
ecmaFeatures: { modules: true },
|
|
ecmaVersion: 'latest',
|
|
};
|
|
|
|
export default [
|
|
js.configs.recommended,
|
|
eslintConfigPrettier,
|
|
ember.configs.base,
|
|
ember.configs.gjs,
|
|
/**
|
|
* Ignores must be in their own object
|
|
* https://eslint.org/docs/latest/use/configure/ignore
|
|
*/
|
|
{
|
|
ignores: [
|
|
'dist/',
|
|
'node_modules/',
|
|
'coverage/',
|
|
'extension/build/',
|
|
'!**/.*',
|
|
],
|
|
},
|
|
/**
|
|
* https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options
|
|
*/
|
|
{
|
|
linterOptions: {
|
|
reportUnusedDisableDirectives: 'error',
|
|
},
|
|
},
|
|
{
|
|
files: ['**/*.js'],
|
|
languageOptions: {
|
|
parser: babelParser,
|
|
},
|
|
},
|
|
{
|
|
files: ['**/*.{js,gjs}'],
|
|
languageOptions: {
|
|
parserOptions: esmParserOptions,
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
files: ['tests/**/*-test.{js,gjs}'],
|
|
plugins: {
|
|
qunit,
|
|
},
|
|
},
|
|
/**
|
|
* CJS node files
|
|
*/
|
|
{
|
|
files: [
|
|
'**/*.cjs',
|
|
'config/**/*.js',
|
|
'testem.js',
|
|
'testem*.js',
|
|
'.prettierrc.js',
|
|
'.stylelintrc.js',
|
|
'.template-lintrc.js',
|
|
'ember-cli-build.js',
|
|
],
|
|
plugins: {
|
|
n,
|
|
},
|
|
|
|
languageOptions: {
|
|
sourceType: 'script',
|
|
ecmaVersion: 'latest',
|
|
globals: {
|
|
...globals.node,
|
|
},
|
|
},
|
|
},
|
|
/**
|
|
* ESM node files
|
|
*/
|
|
{
|
|
files: ['**/*.mjs'],
|
|
plugins: {
|
|
n,
|
|
},
|
|
|
|
languageOptions: {
|
|
sourceType: 'module',
|
|
ecmaVersion: 'latest',
|
|
parserOptions: esmParserOptions,
|
|
globals: {
|
|
...globals.node,
|
|
},
|
|
},
|
|
},
|
|
];
|