Skip to content

Commit

Permalink
Updated eslint to v9 (#158)
Browse files Browse the repository at this point in the history
* chore: Updated eslint to v9

* chore: Updated shared eslint configurations

* chore: Updated project configurations

* chore: Fixed lint errors

* chore: Added lockfile

* chore: Added changeset

---------

Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
  • Loading branch information
ijlee2 and ijlee2 authored Feb 5, 2025
1 parent e086f60 commit 035d988
Show file tree
Hide file tree
Showing 75 changed files with 1,157 additions and 941 deletions.
13 changes: 13 additions & 0 deletions .changeset/tiny-numbers-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"ember-codemod-remove-ember-css-modules": patch
"my-app-with-ember-css-modules": patch
"embroider-css-modules": patch
"test-app-for-embroider-css-modules": patch
"type-css-modules": patch
"test-app-for-my-v2-addon": patch
"my-v1-addon": patch
"my-v2-addon": patch
"my-app": patch
---

Updated eslint to v9
File renamed without changes.
7 changes: 4 additions & 3 deletions configs/ember-template-lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
"url": "https://github.com/ijlee2/embroider-css-modules.git"
},
"author": "Isaac J. Lee",
"main": ".template-lintrc.js",
"type": "module",
"main": ".template-lintrc.cjs",
"scripts": {
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
"lint:fix": "concurrently \"npm: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.

File renamed without changes.
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: ['**/*.gts'],
parser: 'ember-eslint-parser',
extends: ['plugin:ember/recommended-gts'],
},
{
files: ['**/*.gjs'],
parser: 'ember-eslint-parser',
extends: ['plugin:ember/recommended-gjs'],
},
{
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;
21 changes: 13 additions & 8 deletions configs/eslint/ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@
"url": "https://github.com/ijlee2/embroider-css-modules.git"
},
"author": "Isaac J. Lee",
"type": "module",
"main": "app/index.js",
"scripts": {
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
"lint:fix": "concurrently \"npm: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 @@ -27,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

0 comments on commit 035d988

Please sign in to comment.