From 5ecaef737bf3e70e0545637e14b53a12e44befc0 Mon Sep 17 00:00:00 2001 From: carmelobuscemi Date: Thu, 12 Dec 2024 09:33:10 +0100 Subject: [PATCH] fix: missing prettier import in recommended --- src/configs/angular-recommended.ts | 69 +++++++------ src/configs/angular-template-recommended.ts | 8 +- src/configs/recommended.ts | 105 ++++++++++---------- src/index.ts | 20 ++-- src/utils/ignore-files-list.ts | 4 +- src/utils/index.ts | 2 +- 6 files changed, 107 insertions(+), 101 deletions(-) diff --git a/src/configs/angular-recommended.ts b/src/configs/angular-recommended.ts index b69d178..e998099 100644 --- a/src/configs/angular-recommended.ts +++ b/src/configs/angular-recommended.ts @@ -1,41 +1,40 @@ -import ngrx from '@ngrx/eslint-plugin/v9' +import ngrx from "@ngrx/eslint-plugin/v9"; import angular from "angular-eslint"; import tsEslint from "typescript-eslint"; -import { ignores } from '../utils'; -import recommendedConfig from './recommended'; +import { ignores } from "../utils"; +import recommendedConfig from "./recommended"; -export default tsEslint.config( - { - name: "devmy-angular-ts-recommended", - ignores, - files: ["**/*.ts"], - extends: [ - ...ngrx.configs.all, - ...angular.configs.tsRecommended, - recommendedConfig, +export default tsEslint.config({ + name: "devmy-angular-ts-recommended", + ignores, + files: ["**/*.ts"], + extends: [ + ...ngrx.configs.all, + ...angular.configs.tsRecommended, + recommendedConfig, + ], + processor: angular.processInlineTemplates, + rules: { + "@angular-eslint/directive-selector": [ + "error", + { + type: "attribute", + prefix: "app", + style: "camelCase", + }, + ], + "@angular-eslint/component-selector": [ + "error", + { + type: "element", + prefix: "app", + style: "kebab-case", + }, + ], + "@angular-eslint/component-class-suffix": [ + "error", + { suffixes: ["Page", "Component"] }, ], - processor: angular.processInlineTemplates, - rules: { - '@angular-eslint/directive-selector': [ - 'error', - { - type: 'attribute', - prefix: 'app', - style: 'camelCase', - }, - ], - '@angular-eslint/component-selector': [ - 'error', - { - type: 'element', - prefix: 'app', - style: 'kebab-case', - }, - ], - "@angular-eslint/component-class-suffix": [ - "error", { suffixes: ["Page", "Component"] } - ], - }, }, -); \ No newline at end of file +}); diff --git a/src/configs/angular-template-recommended.ts b/src/configs/angular-template-recommended.ts index 7170b01..f4ec818 100644 --- a/src/configs/angular-template-recommended.ts +++ b/src/configs/angular-template-recommended.ts @@ -1,7 +1,7 @@ import angular from "angular-eslint"; import tsEslint from "typescript-eslint"; -import { ignores } from '../utils'; +import { ignores } from "../utils"; export default tsEslint.config({ name: "devmy-angular-template-recommended", @@ -13,6 +13,6 @@ export default tsEslint.config({ ], rules: { "@angular-eslint/template/attributes-order": "error", - "@angular-eslint/template/prefer-self-closing-tags": "error" - } -}); \ No newline at end of file + "@angular-eslint/template/prefer-self-closing-tags": "error", + }, +}); diff --git a/src/configs/recommended.ts b/src/configs/recommended.ts index 0388901..477873f 100644 --- a/src/configs/recommended.ts +++ b/src/configs/recommended.ts @@ -1,76 +1,81 @@ -import eslint from '@eslint/js'; -import stylisticTs from '@stylistic/eslint-plugin-ts' -import { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; -import simpleImportSort from 'eslint-plugin-simple-import-sort'; +import eslint from "@eslint/js"; +import stylisticTs from "@stylistic/eslint-plugin-ts"; +import { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; +import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; +import simpleImportSort from "eslint-plugin-simple-import-sort"; import sonar from "eslint-plugin-sonarjs"; -import eslintPluginUnicorn from 'eslint-plugin-unicorn'; -import tsEslint from 'typescript-eslint'; +import eslintPluginUnicorn from "eslint-plugin-unicorn"; +import tsEslint from "typescript-eslint"; -import { ignores } from '../utils'; +import { ignores } from "../utils"; export default tsEslint.config({ name: "devmy-recommended", ignores, - plugins: { + plugins: { sonar, unicorn: eslintPluginUnicorn, - 'simple-import-sort': simpleImportSort, - '@stylistic': stylisticTs + "simple-import-sort": simpleImportSort, + "@stylistic": stylisticTs, }, - files: ['**/*.ts'], + files: ["**/*.ts"], extends: [ eslint.configs.recommended, sonar.configs.recommended, ...tsEslint.configs.recommended, ...tsEslint.configs.stylistic, + eslintPluginPrettierRecommended, ], rules: { "@stylistic/space-before-blocks": "error", "@stylistic/padding-line-between-statements": [ "error", - { - "blankLine": "always", - "prev": "*", - "next": "return" - } + { + blankLine: "always", + prev: "*", + next: "return", + }, ], "@typescript-eslint/array-type": ["error", { default: "array-simple" }], - '@typescript-eslint/ban-ts-comment': 0, + "@typescript-eslint/ban-ts-comment": 0, "@typescript-eslint/explicit-member-accessibility": "error", - '@typescript-eslint/explicit-function-return-type': 'error', - "@typescript-eslint/max-params": ["error", { max: 3 }], - 'arrow-body-style': ['error', 'as-needed'], - 'curly': 'error', - 'default-case': 'error', - 'eqeqeq': 'error', - 'id-length': ['error', { 'min': 2, 'exceptions': ['x', 'y', 'z', 'i', 'j', '_'] }], - 'max-classes-per-file': ['error', 2], - 'max-depth': ['error', 4], - 'max-lines': [1, { max: 150 }], - 'max-lines-per-function': [1, { max: 40 }], - 'max-nested-callbacks': ['error', 3], - 'no-console': 'error', - 'no-magic-numbers': [ - "error", - { - "detectObjects": false, - "ignoreArrayIndexes": true, - "ignoreDefaultValues": true, - "ignoreClassFieldInitialValues": true, - "ignore": [0, 1] - } + "@typescript-eslint/explicit-function-return-type": "error", + "@typescript-eslint/max-params": ["error", { max: 3 }], + "arrow-body-style": ["error", "as-needed"], + curly: "error", + "default-case": "error", + eqeqeq: "error", + "id-length": [ + "error", + { min: 2, exceptions: ["x", "y", "z", "i", "j", "_"] }, + ], + "max-classes-per-file": ["error", 2], + "max-depth": ["error", 4], + "max-lines": [1, { max: 150 }], + "max-lines-per-function": [1, { max: 40 }], + "max-nested-callbacks": ["error", 3], + "no-console": "error", + "no-magic-numbers": [ + "error", + { + detectObjects: false, + ignoreArrayIndexes: true, + ignoreDefaultValues: true, + ignoreClassFieldInitialValues: true, + ignore: [0, 1], + }, ], - 'no-multi-assign': 'error', - 'no-nested-ternary': 'error', - 'no-shadow': 'off', - 'no-undefined': 'error', - 'no-unneeded-ternary': 'error', - 'simple-import-sort/exports': 'error', - 'simple-import-sort/imports': 'error', - 'yoda': 'error', - 'no-unused-vars': 'off', + "no-multi-assign": "error", + "no-nested-ternary": "error", + "no-shadow": "off", + "no-undefined": "error", + "no-unneeded-ternary": "error", + "simple-import-sort/exports": "error", + "simple-import-sort/imports": "error", + yoda: "error", + "no-unused-vars": "off", "unicorn/better-regex": "error", "unicorn/explicit-length-check": "error", "unicorn/no-abusive-eslint-disable": "error", - } -}) as FlatConfig.Config; \ No newline at end of file + }, +}) as FlatConfig.Config; diff --git a/src/index.ts b/src/index.ts index 374b439..b73b243 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,22 +1,24 @@ import fs from "fs"; -import angularRecommendedConfig from './configs/angular-recommended'; -import angularTemplateRecommendedConfig from './configs/angular-template-recommended'; -import recommendedConfig from './configs/recommended'; +import angularRecommendedConfig from "./configs/angular-recommended"; +import angularTemplateRecommendedConfig from "./configs/angular-template-recommended"; +import recommendedConfig from "./configs/recommended"; -const pkg: Record = JSON.parse(fs.readFileSync('./package.json', "utf8")); +const pkg: Record = JSON.parse( + fs.readFileSync("./package.json", "utf8"), +); const plugin = { meta: { name: pkg.name, - version: pkg.version + version: pkg.version, }, configs: { recommended: recommendedConfig, - 'angular-recommended': angularRecommendedConfig, - 'angular-template-recommended': angularTemplateRecommendedConfig, + "angular-recommended": angularRecommendedConfig, + "angular-template-recommended": angularTemplateRecommendedConfig, }, - rules: {} + rules: {}, }; -export default plugin; \ No newline at end of file +export default plugin; diff --git a/src/utils/ignore-files-list.ts b/src/utils/ignore-files-list.ts index 574e993..4a88e7d 100644 --- a/src/utils/ignore-files-list.ts +++ b/src/utils/ignore-files-list.ts @@ -1,4 +1,4 @@ -export const ignores = [ +export const ignores = [ "projects/**/*", "**/dist", "**/node_modules", @@ -9,4 +9,4 @@ export const ignores = [ "**/.vscode", "**/.idea", "**/.nx", -]; \ No newline at end of file +]; diff --git a/src/utils/index.ts b/src/utils/index.ts index faea1dd..e3a9d8d 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1 +1 @@ -export * from './ignore-files-list'; \ No newline at end of file +export * from "./ignore-files-list";