Skip to content

Commit

Permalink
remove renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluzzi committed Dec 25, 2024
1 parent 54ac4c8 commit 46caba2
Show file tree
Hide file tree
Showing 14 changed files with 5,008 additions and 5,061 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@bluzzi/eslint-config",
"description": "ESLint configuration preset for linting and formatting all your files",
"version": "1.3.8",
"version": "1.3.9",
"license": "MIT",
"author": "Bluzzi",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions scripts/typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const combine = async (...configs: Awaitable<TypedFlatConfigItem | TypedF
};

const configs = await combine(
// eslint-disable-next-line ts/no-deprecated
{ plugins: { "": { rules: Object.fromEntries(builtinRules.entries()) } } },
// eslint-disable-next-line @typescript-eslint/no-deprecated
{ name: "bluzzi/eslint", plugins: { "": { rules: Object.fromEntries(builtinRules.entries()) } } },
javascript(),
node(),
stylistic(),
Expand Down
75 changes: 36 additions & 39 deletions src/configs/ignore/config.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,41 @@
import type { TypedFlatConfigItem } from "#/types/type";
import { configName } from "#/utils/naming";

export const ignore = (): TypedFlatConfigItem[] => {
return [
{
name: configName("ignore", "rules"),
ignores: [
"**/node_modules",
"**/dist",
"**/package-lock.json",
"**/yarn.lock",
"**/pnpm-lock.yaml",
"**/bun.lockb",
export const ignore = (): TypedFlatConfigItem => {
return {
name: "bluzzi/ignore",
ignores: [
"**/node_modules",
"**/dist",
"**/package-lock.json",
"**/yarn.lock",
"**/pnpm-lock.yaml",
"**/bun.lockb",

"**/output",
"**/coverage",
"**/temp",
"**/.temp",
"**/tmp",
"**/.tmp",
"**/.history",
"**/.vitepress/cache",
"**/.nuxt",
"**/.next",
"**/.vercel",
"**/.changeset",
"**/.idea",
"**/.cache",
"**/.output",
"**/.vite-inspect",
"**/.yarn",
"**/.eslint-config-inspector",
"**/output",
"**/coverage",
"**/temp",
"**/.temp",
"**/tmp",
"**/.tmp",
"**/.history",
"**/.vitepress/cache",
"**/.nuxt",
"**/.next",
"**/.vercel",
"**/.changeset",
"**/.idea",
"**/.cache",
"**/.output",
"**/.vite-inspect",
"**/.yarn",
"**/.eslint-config-inspector",

"**/CHANGELOG*.md",
"**/*.min.*",
"**/LICENSE*",
"**/__snapshots__",
"**/auto-import?(s).d.ts",
"**/components.d.ts",
],
},
];
"**/CHANGELOG*.md",
"**/*.min.*",
"**/LICENSE*",
"**/__snapshots__",
"**/auto-import?(s).d.ts",
"**/components.d.ts",
],
};
};
13 changes: 5 additions & 8 deletions src/configs/javascript/config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import type { TypedFlatConfigItem } from "#/types/type";
import { configName } from "#/utils/naming";
import globals from "globals";
import js from "@eslint/js";

export const javascript = (): TypedFlatConfigItem[] => {
const recommendedRules = js.configs.recommended.rules;

return [{
name: configName("javascript", "rules"),
export const javascript = (): TypedFlatConfigItem => {
return {
name: "bluzzi/javascript",
languageOptions: {
globals: {
...globals.browser,
Expand All @@ -25,7 +22,7 @@ export const javascript = (): TypedFlatConfigItem[] => {
reportUnusedDisableDirectives: true,
},
rules: {
...recommendedRules,
...js.configs.recommended.rules,
"array-callback-return": "error",
"no-await-in-loop": "error",
"no-constructor-return": "error",
Expand Down Expand Up @@ -91,5 +88,5 @@ export const javascript = (): TypedFlatConfigItem[] => {
"require-unicode-regexp": "error",
"yoda": "error",
},
}];
};
};
41 changes: 14 additions & 27 deletions src/configs/nextjs/config.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
/* eslint-disable ts/no-unsafe-member-access */
/* eslint-disable ts/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */

import type { TypedFlatConfigItem } from "#/types/type";
import { nextjsPlugin } from "#/utils/extension";
import { configName, renameRules } from "#/utils/naming";

export const nextjs = (): TypedFlatConfigItem[] => {
const recommendedRules = renameRules(
nextjsPlugin.configs.recommended.rules as Record<string, string>,
{ "@next/next": "nextjs" },
);

const recommendedCoreRules = renameRules(
nextjsPlugin.configs["core-web-vitals"].rules as Record<string, string>,
{ "@next/next": "nextjs" },
);

return [
{
name: configName("nextjs", "rules"),
files: ["**/*.ts", "**/*.tsx"],
plugins: {
nextjs: nextjsPlugin,
},
rules: {
// https://github.com/vercel/next.js/blob/7a47ed5123b8dac03e9483cb823e224370da2667/packages/eslint-plugin-next/src/index.ts#L26
...recommendedRules,
...recommendedCoreRules,
},
export const nextjs = (): TypedFlatConfigItem => {
return {
name: "bluzzi/nextjs",
files: ["**/*.ts", "**/*.tsx"],
plugins: {
"@next/next": nextjsPlugin,
},
rules: {
// https://github.com/vercel/next.js/blob/7a47ed5123b8dac03e9483cb823e224370da2667/packages/eslint-plugin-next/src/index.ts#L26
...nextjsPlugin.configs.recommended.rules,
...nextjsPlugin.configs["core-web-vitals"].rules,
},
];
};
};
25 changes: 11 additions & 14 deletions src/configs/node/config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import type { TypedFlatConfigItem } from "#/types/type";
import { nodePlugin } from "#/utils/extension";
import { configName } from "#/utils/naming";

export const node = (): TypedFlatConfigItem[] => {
return [
{
name: configName("node", "rules"),
plugins: {
node: nodePlugin,
},
rules: {
"node/no-deprecated-api": "error",
"node/no-new-require": "error",
"node/no-path-concat": "error",
},
export const node = (): TypedFlatConfigItem => {
return {
name: "bluzzi/node",
plugins: {
n: nodePlugin,
},
];
rules: {
"n/no-deprecated-api": "error",
"n/no-new-require": "error",
"n/no-path-concat": "error",
},
};
};
46 changes: 15 additions & 31 deletions src/configs/react/config.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
import type { TypedFlatConfigItem } from "#/types/type";
import { reactPlugin } from "#/utils/extension";
import { configName, renameRules } from "#/utils/naming";

export const react = (): TypedFlatConfigItem[] => {
const recommendedRules = renameRules(
reactPlugin.configs.recommended.rules,
{
"@eslint-react/naming-convention": "react-naming-convention",
"@eslint-react/hooks-extra": "react-hooks-extra",
"@eslint-react/dom": "react-dom",
"@eslint-react": "react",
export const react = (): TypedFlatConfigItem => {
return {
name: "bluzzi/react",
files: ["**/*.ts", "**/*.tsx"],
plugins: {
...reactPlugin.configs.recommended.plugins,
},
);

return [
{
name: configName("react", "rules"),
files: ["**/*.ts", "**/*.tsx"],
plugins: {
"react": reactPlugin.configs.all.plugins["@eslint-react"],
"react-dom": reactPlugin.configs.all.plugins["@eslint-react/dom"],
"react-hooks-extra": reactPlugin.configs.all.plugins["@eslint-react/hooks-extra"],
"react-naming-convention": reactPlugin.configs.all.plugins["@eslint-react/naming-convention"],
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
sourceType: "module",
},
rules: {
...recommendedRules,
},
sourceType: "module",
},
rules: {
...reactPlugin.configs.recommended.rules,
},
];
};
};
35 changes: 17 additions & 18 deletions src/configs/stylistic/config.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
import type { ParamsStylistic } from "./type";
import type { TypedFlatConfigItem } from "#/types/type";
import { antfuPlugin, stylisticPlugin } from "#/utils/extension";
import { configName } from "#/utils/naming";

export const stylistic = ({ indent = 2, quotes = "double", semi = true, jsx = false }: ParamsStylistic = {}): TypedFlatConfigItem[] => {
const config = stylisticPlugin.configs.customize({ pluginName: "style", indent, quotes, semi, jsx });
export const stylistic = ({ indent = 2, quotes = "double", semi = true, jsx = false }: ParamsStylistic = {}): TypedFlatConfigItem => {
const config = stylisticPlugin.configs.customize({ indent, quotes, semi, jsx });

return [{
name: configName("stylistic", "rules"),
return {
name: "bluzzi/stylistic",
plugins: {
antfu: antfuPlugin,
style: stylisticPlugin,
"antfu": antfuPlugin,
"@stylistic": stylisticPlugin,
},
rules: {
...config.rules,

"style/semi-style": "error",
"style/no-extra-semi": "error",
"style/function-call-spacing": "error",
"style/generator-star-spacing": ["error", { before: false, after: true }],
"style/implicit-arrow-linebreak": ["error", "beside"],
"style/wrap-regex": "error",
"style/nonblock-statement-body-position": "error",
"@stylistic/semi-style": "error",
"@stylistic/no-extra-semi": "error",
"@stylistic/function-call-spacing": "error",
"@stylistic/generator-star-spacing": ["error", { before: false, after: true }],
"@stylistic/implicit-arrow-linebreak": ["error", "beside"],
"@stylistic/wrap-regex": "error",
"@stylistic/nonblock-statement-body-position": "error",

"style/jsx-props-no-multi-spaces": ["error"],
"style/jsx-self-closing-comp": ["error", { component: true, html: true }],
"style/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
"@stylistic/jsx-props-no-multi-spaces": ["error"],
"@stylistic/jsx-self-closing-comp": ["error", { component: true, html: true }],
"@stylistic/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],

"antfu/consistent-list-newline": "error",
},
}];
};
};
Loading

0 comments on commit 46caba2

Please sign in to comment.