diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 768fab3..0000000 --- a/.eslintignore +++ /dev/null @@ -1,14 +0,0 @@ -# unconventional js -/blueprints/*/files/ - -# compiled output -/declarations/ -/dist/ - -# misc -/coverage/ -!.* -.*/ - -# ember-try -/.node_modules.ember-try/ diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index ade61fb..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; - -module.exports = { - root: true, - parser: '@babel/eslint-parser', - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - requireConfigFile: false, - babelOptions: { - plugins: [ - ['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }], - ], - }, - }, - plugins: ['ember'], - extends: [ - 'eslint:recommended', - 'plugin:ember/recommended', - 'plugin:prettier/recommended', - ], - env: { - browser: true, - }, - rules: {}, - overrides: [ - // node files - { - files: [ - './.eslintrc.js', - './.prettierrc.js', - './.stylelintrc.js', - './.template-lintrc.js', - './ember-cli-build.js', - './index.js', - './testem.js', - './blueprints/*/index.js', - './config/**/*.js', - './tests/dummy/config/**/*.js', - ], - parserOptions: { - sourceType: 'script', - }, - env: { - browser: false, - node: true, - }, - extends: ['plugin:n/recommended'], - }, - { - // test files - files: ['tests/**/*-test.{js,ts}'], - extends: ['plugin:qunit/recommended'], - }, - ], -}; diff --git a/.npmignore b/.npmignore index 8c9fd97..8c51744 100644 --- a/.npmignore +++ b/.npmignore @@ -7,8 +7,6 @@ /.ember-cli /.env* /.eslintcache -/.eslintignore -/.eslintrc.js /.git/ /.github/ /.gitignore @@ -21,6 +19,7 @@ /.watchmanconfig /CONTRIBUTING.md /ember-cli-build.js +/eslint.config.mjs /testem.js /tests/ /tsconfig.declarations.json diff --git a/.prettierrc.js b/.prettierrc.js index e5f7b6d..7c49e9d 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,12 +1,20 @@ 'use strict'; module.exports = { + plugins: ['prettier-plugin-ember-template-tag'], overrides: [ { - files: '*.{js,ts}', + files: '*.{js,gjs,ts,gts,mjs,mts,cjs,cts}', options: { singleQuote: true, }, }, + { + files: '*.{gjs,gts}', + options: { + singleQuote: true, + templateSingleQuote: false, + }, + }, ], }; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..b895cc4 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,121 @@ +/** + * 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 prettier from 'eslint-plugin-prettier/recommended'; +import qunit from 'eslint-plugin-qunit'; +import n from 'eslint-plugin-n'; + +import babelParser from '@babel/eslint-parser'; + +const esmParserOptions = { + ecmaFeatures: { modules: true }, + ecmaVersion: 'latest', + requireConfigFile: false, + babelOptions: { + plugins: [ + ['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }], + ], + }, +}; + +export default [ + js.configs.recommended, + prettier, + 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/', '!**/.*'], + }, + /** + * 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, + }, + }, + }, +]; diff --git a/package.json b/package.json index a400491..6461def 100644 --- a/package.json +++ b/package.json @@ -14,63 +14,67 @@ }, "scripts": { "build": "ember build --environment=production", - "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", + "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\" --prefixColors auto", "lint:css": "stylelint \"**/*.css\"", "lint:css:fix": "concurrently \"npm:lint:css -- --fix\"", - "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"", + "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\" --prefixColors auto", "lint:hbs": "ember-template-lint .", "lint:hbs:fix": "ember-template-lint . --fix", "lint:js": "eslint . --cache", "lint:js:fix": "eslint . --fix", "start": "ember serve", - "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"", + "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\" --prefixColors auto", "test:ember": "ember test", "test:ember-compatibility": "ember try:each" }, "dependencies": { - "@babel/core": "^7.25.2", + "@babel/core": "^7.26.0", "ember-cli-babel": "^8.2.0", - "ember-cli-htmlbars": "^6.3.0" + "ember-cli-htmlbars": "^6.3.0", + "ember-template-imports": "^4.2.0" }, "devDependencies": { - "@babel/eslint-parser": "^7.25.1", - "@babel/plugin-proposal-decorators": "^7.24.7", - "@ember/optional-features": "^2.1.0", - "@ember/test-helpers": "^3.3.1", + "@babel/eslint-parser": "^7.25.9", + "@babel/plugin-proposal-decorators": "^7.25.9", + "@ember/optional-features": "^2.2.0", + "@ember/test-helpers": "^4.0.4", "@embroider/test-setup": "^4.0.0", + "@eslint/js": "^9.14.0", "@glimmer/component": "^1.1.2", "@glimmer/tracking": "^1.1.2", "broccoli-asset-rev": "^3.0.0", - "concurrently": "^8.2.2", - "ember-auto-import": "^2.8.1", - "ember-cli": "~6.0.0-beta.0", + "concurrently": "^9.1.0", + "ember-auto-import": "^2.10.0", + "ember-cli": "~6.1.0-beta.0", "ember-cli-clean-css": "^3.0.0", "ember-cli-dependency-checker": "^3.3.2", "ember-cli-inject-live-reload": "^2.1.0", "ember-cli-sri": "^2.1.1", "ember-cli-terser": "^4.0.2", - "ember-load-initializers": "^2.1.2", + "ember-load-initializers": "^3.0.1", "ember-page-title": "^8.2.3", - "ember-qunit": "^8.1.0", - "ember-resolver": "^12.0.1", - "ember-source": "~6.0.0-beta.1", + "ember-qunit": "^8.1.1", + "ember-resolver": "^13.0.2", + "ember-source": "~6.1.0-beta.1", "ember-source-channel-url": "^3.0.0", "ember-template-lint": "^6.0.0", "ember-try": "^3.0.0", - "eslint": "^8.57.1", + "eslint": "^9.14.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-ember": "^12.2.1", - "eslint-plugin-n": "^16.6.2", + "eslint-plugin-ember": "^12.3.1", + "eslint-plugin-n": "^17.13.1", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-qunit": "^8.1.2", + "globals": "^15.12.0", "loader.js": "^4.7.0", "prettier": "^3.3.3", + "prettier-plugin-ember-template-tag": "^2.0.4", "qunit": "^2.22.0", - "qunit-dom": "^3.2.1", - "stylelint": "^15.11.0", - "stylelint-config-standard": "^34.0.0", - "stylelint-prettier": "^4.1.0", - "webpack": "^5.95.0" + "qunit-dom": "^3.3.0", + "stylelint": "^16.10.0", + "stylelint-config-standard": "^36.0.1", + "stylelint-prettier": "^5.0.2", + "webpack": "^5.96.1" }, "peerDependencies": { "ember-source": ">= 4.0.0" diff --git a/tests/dummy/config/ember-cli-update.json b/tests/dummy/config/ember-cli-update.json index e835eb6..ed00d11 100644 --- a/tests/dummy/config/ember-cli-update.json +++ b/tests/dummy/config/ember-cli-update.json @@ -3,7 +3,7 @@ "packages": [ { "name": "ember-cli", - "version": "6.0.0-beta.0", + "version": "6.1.0-beta.0", "blueprints": [ { "name": "addon",