Skip to content

Commit

Permalink
Merge pull request #1 from Slexom/fix/missing-prettier-import
Browse files Browse the repository at this point in the history
fix: missing prettier import in recommended
  • Loading branch information
Gabriele-bil authored Dec 12, 2024
2 parents fd925ce + 5ecaef7 commit 954cadc
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 101 deletions.
69 changes: 34 additions & 35 deletions src/configs/angular-recommended.ts
Original file line number Diff line number Diff line change
@@ -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({

Check failure on line 8 in src/configs/angular-recommended.ts

View workflow job for this annotation

GitHub Actions / release

The inferred type of 'default' cannot be named without a reference to 'typescript-eslint/node_modules/@typescript-eslint/utils/ts-eslint'. This is likely not portable. A type annotation is necessary.
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"] }
],
},
},
);
});
8 changes: 4 additions & 4 deletions src/configs/angular-template-recommended.ts
Original file line number Diff line number Diff line change
@@ -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({

Check failure on line 6 in src/configs/angular-template-recommended.ts

View workflow job for this annotation

GitHub Actions / release

The inferred type of 'default' cannot be named without a reference to 'typescript-eslint/node_modules/@typescript-eslint/utils/ts-eslint'. This is likely not portable. A type annotation is necessary.
name: "devmy-angular-template-recommended",
Expand All @@ -13,6 +13,6 @@ export default tsEslint.config({
],
rules: {
"@angular-eslint/template/attributes-order": "error",
"@angular-eslint/template/prefer-self-closing-tags": "error"
}
});
"@angular-eslint/template/prefer-self-closing-tags": "error",
},
});
105 changes: 55 additions & 50 deletions src/configs/recommended.ts
Original file line number Diff line number Diff line change
@@ -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;
},
}) as FlatConfig.Config;
20 changes: 11 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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<string, string> = JSON.parse(fs.readFileSync('./package.json', "utf8"));
const pkg: Record<string, string> = JSON.parse(
fs.readFileSync("./package.json", "utf8"),
);

const plugin = {

Check failure on line 11 in src/index.ts

View workflow job for this annotation

GitHub Actions / release

The inferred type of 'plugin' cannot be named without a reference to 'typescript-eslint/node_modules/@typescript-eslint/utils/ts-eslint'. This is likely not portable. A type annotation is necessary.
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;
export default plugin;
4 changes: 2 additions & 2 deletions src/utils/ignore-files-list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const ignores = [
export const ignores = [
"projects/**/*",
"**/dist",
"**/node_modules",
Expand All @@ -9,4 +9,4 @@ export const ignores = [
"**/.vscode",
"**/.idea",
"**/.nx",
];
];
2 changes: 1 addition & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './ignore-files-list';
export * from "./ignore-files-list";

0 comments on commit 954cadc

Please sign in to comment.