Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated eslint to v9 #70

Merged
merged 6 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/tricky-toys-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"create-v2-addon-repo": minor
"blueprints-v2-addon": minor
"analyze-ember-project-dependencies": patch
---

Updated eslint to v9
14 changes: 10 additions & 4 deletions configs/ember-template-lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@shared-configs/ember-template-lint",
"version": "0.0.0",
"private": true,
"description": "Shared configuration for ember-template-lint",
"main": ".template-lintrc.js",
"description": "Configuration for ember-template-lint",
"repository": {
"type": "git",
"url": "https://github.com/ijlee2/embroider-toolbox.git"
},
"author": "Isaac J. Lee",
"type": "module",
"main": ".template-lintrc.cjs",
"scripts": {
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
"lint:js": "prettier --check \"**/*.js\"",
"lint:js:fix": "prettier --write \"**/*.js\""
"lint:js": "prettier . --check",
"lint:js:fix": "prettier . --write"
},
"dependencies": {
"ember-template-lint-plugin-prettier": "^5.0.0"
Expand Down
7 changes: 0 additions & 7 deletions configs/eslint/ember/.eslintrc.js

This file was deleted.

262 changes: 167 additions & 95 deletions configs/eslint/ember/app/index.js
Original file line number Diff line number Diff line change
@@ -1,109 +1,181 @@
'use strict';
import babelEslintParser from '@babel/eslint-parser';
import eslint from '@eslint/js';
// eslint-disable-next-line import/no-unresolved
import eslintPluginEmber from 'eslint-plugin-ember/recommended';
import eslintPluginImport from 'eslint-plugin-import';
import eslintPluginN from 'eslint-plugin-n';
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
import eslintPluginQunit from 'eslint-plugin-qunit';
import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
import eslintPluginTypescriptSortKeys from 'eslint-plugin-typescript-sort-keys';
import globals from 'globals';
// eslint-disable-next-line import/no-unresolved
import tseslint from 'typescript-eslint';

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
const parserOptionsJs = {
babelOptions: {
plugins: [
[
'@babel/plugin-proposal-decorators',
{
decoratorsBeforeExport: true,
},
],
],
},
ecmaFeatures: {
modules: true,
},
plugins: [
'ember',
'@typescript-eslint',
'simple-import-sort',
'typescript-sort-keys',
],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:prettier/recommended',
'plugin:typescript-sort-keys/recommended',
],
env: {
browser: true,
ecmaVersion: 'latest',
requireConfigFile: false,
};

const parserOptionsTs = {
projectService: true,
tsconfigRootDir: import.meta.dirname,
};

export default tseslint.config(
{
ignores: ['dist/', 'node_modules/', '!.*', '.*/'],
},
rules: {
curly: 'error',
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
settings: {
'import/resolver': {
node: {
extensions: ['.gjs', '.gts', '.js', '.ts'],
},
typescript: true,
{
plugins: {
'simple-import-sort': eslintPluginSimpleImportSort,
},
rules: {
curly: 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},

eslint.configs.recommended,
eslintPluginEmber.configs.base,
eslintPluginEmber.configs.gjs,
eslintPluginImport.flatConfigs.recommended,
eslintPluginPrettier,

// Ember files
{
files: ['**/*.js'],
languageOptions: {
parser: babelEslintParser,
},
},
overrides: [
// Ember files
{
files: ['**/*.{gts,ts}'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
{
files: ['**/*.{gjs,js}'],
languageOptions: {
globals: globals.browser,
parserOptions: parserOptionsJs,
},
rules: {
'import/no-duplicates': 'error',
'import/no-unresolved': [
'error',
{
ignore: ['^@ember', '^ember', 'fetch'],
},
],
rules: {
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-empty-object-type': [
'error',
{
allowInterfaces: 'always',
allowObjectTypes: 'always',
},
],
'@typescript-eslint/no-import-type-side-effects': 'error',
},
},
{
files: ['**/*.gjs'],
parser: 'ember-eslint-parser',
extends: ['plugin:ember/recommended-gjs'],
},
{
files: ['**/*.gts'],
parser: 'ember-eslint-parser',
extends: ['plugin:ember/recommended-gts'],
},
{
files: ['**/*.{gjs,gts,js,ts}'],
rules: {
'import/no-duplicates': 'error',
'import/no-unresolved': [
'error',
{ ignore: ['^@ember', '^dummy/', '^ember', 'fetch'] },
],
settings: {
'import/resolver': {
node: {
extensions: ['.gjs', '.gts', '.js', '.ts'],
},
},
},
// Node files
{
files: [
'./.eslintrc.{cjs,js}',
'./.prettierrc.{cjs,js}',
'./.stylelintrc.{cjs,js}',
'./.template-lintrc.{cjs,js}',
'./ember-cli-build.js',
'./postcss.config.js',
'./testem.js',
'./vite.config.{js,mjs}',
'./blueprints/*/index.js',
'./config/**/*.js',
'./lib/*/index.js',
'./server/**/*.js',
},
{
extends: [
...tseslint.configs.recommended,
eslintPluginEmber.configs.gts,
eslintPluginImport.flatConfigs.typescript,
],
files: ['**/*.{gts,ts}'],
languageOptions: {
parser: eslintPluginEmber.parser,
parserOptions: parserOptionsTs,
},
plugins: {
'typescript-sort-keys': eslintPluginTypescriptSortKeys,
},
rules: {
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-empty-object-type': [
'error',
{
allowInterfaces: 'always',
allowObjectTypes: 'always',
},
],
env: {
browser: false,
node: true,
'@typescript-eslint/no-import-type-side-effects': 'error',
'import/no-duplicates': 'error',
'import/no-unresolved': [
'error',
{
ignore: ['^@ember', '^ember', 'fetch'],
},
],
'typescript-sort-keys/interface': 'error',
'typescript-sort-keys/string-enum': 'error',
},
settings: {
'import/resolver': {
node: {
extensions: ['.gjs', '.gts', '.js', '.ts'],
},
typescript: true,
},
extends: ['plugin:n/recommended'],
},
// Test files
{
files: ['tests/**/*-test.{gjs,gts,js,ts}'],
extends: ['plugin:qunit/recommended'],
},

// Test files
{
files: ['tests/**/*-test.{gjs,gts,js,ts}'],
plugins: {
qunit: eslintPluginQunit,
},
],
};
},

// Configuration files
{
files: [
'**/*.cjs',
'config/**/*.js',
'.prettierrc.js',
'.stylelintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'postcss.config.js',
'testem.js',
'vite.config.js',
],
languageOptions: {
ecmaVersion: 'latest',
globals: globals.node,
sourceType: 'script',
},
plugins: {
n: eslintPluginN,
},
},
{
files: ['**/*.mjs'],
languageOptions: {
ecmaVersion: 'latest',
globals: globals.node,
parserOptions: parserOptionsJs,
sourceType: 'module',
},
plugins: {
n: eslintPluginN,
},
},
);
3 changes: 3 additions & 0 deletions configs/eslint/ember/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import eslintConfigNodeJavascript from '@shared-configs/eslint-config-node/javascript/index.js';

export default eslintConfigNodeJavascript;
28 changes: 19 additions & 9 deletions configs/eslint/ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@
"name": "@shared-configs/eslint-config-ember",
"version": "0.0.0",
"private": true,
"description": "Shared configuration for eslint (Ember)",
"description": "Configuration for eslint (Ember)",
"repository": {
"type": "git",
"url": "https://github.com/ijlee2/embroider-toolbox.git"
},
"author": "Isaac J. Lee",
"type": "module",
"main": "app/index.js",
"scripts": {
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
"lint:js": "prettier --check \"**/*.js\"",
"lint:js:fix": "prettier --write \"**/*.js\""
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix"
},
"dependencies": {
"@rushstack/eslint-patch": "^1.10.5",
"@typescript-eslint/eslint-plugin": "^8.23.0",
"@typescript-eslint/parser": "^8.23.0",
"@babel/core": "^7.26.7",
"@babel/eslint-parser": "^7.26.5",
"@babel/plugin-proposal-decorators": "^7.25.9",
"@eslint/js": "^9.19.0",
"eslint-config-prettier": "^10.0.1",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-ember": "^12.5.0",
Expand All @@ -22,17 +29,20 @@
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-qunit": "^8.1.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-typescript-sort-keys": "^3.3.0"
"eslint-plugin-typescript-sort-keys": "^3.3.0",
"globals": "^15.14.0",
"typescript-eslint": "^8.23.0"
},
"devDependencies": {
"@shared-configs/eslint-config-node": "workspace:*",
"@shared-configs/prettier": "workspace:*",
"@types/eslint__js": "^8.42.3",
"concurrently": "^9.1.2",
"eslint": "^8.57.1",
"eslint": "^9.19.0",
"prettier": "^3.4.2"
},
"peerDependencies": {
"eslint": "^8.57.1",
"eslint": "^9.1.0",
"prettier": "^3.4.2",
"typescript": "^5.7.3"
},
Expand Down
19 changes: 0 additions & 19 deletions configs/eslint/ember/patch.js

This file was deleted.

Loading