/** * 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 { defineConfig, globalIgnores } from 'eslint/config'; import ember from 'eslint-plugin-ember/recommended'; import WarpDrive from 'eslint-plugin-warp-drive/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 defineConfig([ globalIgnores(['dist/', 'coverage/', '!**/.*']), js.configs.recommended, eslintConfigPrettier, ember.configs.base, ember.configs.gjs, ...WarpDrive, /** * 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, }, }, rules: { 'warp-drive/no-external-request-patterns': 'off', // Not sure if we want to replace _all_ regular fetch calls.. 'warp-drive/no-legacy-request-patterns': 'off', // TODO: remove this once we refactored all the code to the new patterns }, }, { ...qunit.configs.recommended, files: ['tests/**/*-test.{js,gjs}'], plugins: { qunit, }, }, /** * CJS node files */ { ...n.configs['flat/recommended-script'], files: ['**/*.cjs', 'config/**/*.js'], plugins: { n, }, languageOptions: { sourceType: 'script', ecmaVersion: 'latest', globals: { ...globals.node, }, }, }, /** * ESM node files */ { ...n.configs['flat/recommended-module'], files: ['**/*.mjs'], plugins: { n, }, languageOptions: { sourceType: 'module', ecmaVersion: 'latest', parserOptions: esmParserOptions, globals: { ...globals.node, }, }, }, ]);