Skip to content

Commit

Permalink
refactor: include deps in eslint-config package
Browse files Browse the repository at this point in the history
  • Loading branch information
0x706b committed Jul 27, 2024
1 parent 7730381 commit 0bc7ae5
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 106 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-scissors-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fncts/eslint-config": patch
---

refactor: include deps in eslint-config package
95 changes: 93 additions & 2 deletions packages/eslint-config/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,94 @@
import baseConfig from "@fncts/eslint-config";
import { FlatCompat } from "@eslint/eslintrc";
import eslint from "@eslint/js";
import { codegen } from "@fncts/codegen/codegen";
import { legacyPlugin } from "@fncts/eslint-config/legacyPlugin";
import path from "node:path";
import { fileURLToPath } from "node:url";
import tseslint from "typescript-eslint";

export default baseConfig;
const dirname = path.dirname(fileURLToPath(import.meta.url));

const compat = new FlatCompat({
baseDirectory: dirname,
recommendedConfig: eslint.configs.recommended,
});

export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, {
plugins: {
import: legacyPlugin(compat, "eslint-plugin-import", "import"),
"simple-import-sort": legacyPlugin(compat, "eslint-plugin-simple-import-sort", "simple-import-sort"),
codegen: {
rules: {
codegen,
},
},
"@0x706b/align-assignments": legacyPlugin(
compat,
"@0x706b/eslint-plugin-align-assignments",
"@0x706b/align-assignments",
),
"@0x706b/module-specifier-extensions": legacyPlugin(
compat,
"@0x706b/eslint-plugin-module-specifier-extensions",
"@0x706b/module-specifier-extensions",
),
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: `${dirname}/../config/tsconfig.base.json`,
},
},
},
rules: {
"@0x706b/align-assignments/align-assignments": "error",
"@0x706b/module-specifier-extensions/module-specifier-extensions": [
"error",
{
remove: ["^@fncts.*$"],
},
],
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-this-alias": "off",
quotes: ["warn", "double", { avoidEscape: true }],
"@typescript-eslint/semi": ["warn", "always"],
"simple-import-sort/exports": "warn",
"simple-import-sort/imports": [
"warn",
{
groups: [["^.*\\u0000$"], ["^\\u0000"], ["^@?\\w"], ["^"], ["^\\."]],
},
],
"codegen/codegen": [
"error",
{
presets: {
pipeable: "@fncts/codegen/pipeable",
barrel: "@fncts/codegen/barrel",
"type-barrel": "@fncts/codegen/type-barrel",
},
},
],
"import/order": "off",
"import/no-unresolved": "error",

"no-case-declarations": "off",
"no-empty": "off",
"no-unexpected-multiline": "off",
"no-fallthrough": "off",
"no-control-regex": "off",
"no-prototype-builtins": "off",
},
});
94 changes: 0 additions & 94 deletions packages/eslint-config/index.js

This file was deleted.

16 changes: 8 additions & 8 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@
"version": "0.0.21",
"type": "module",
"scripts": {
"build": "rm -rf build && mkdir build && mkdir build/mjs && cp index.js build/mjs/index.mjs && cp legacyPlugin.js build/mjs/legacyPlugin.mjs",
"build": "rm -rf build && mkdir build && mkdir build/mjs && cp eslint.config.js build/mjs/index.mjs && cp legacyPlugin.js build/mjs/legacyPlugin.mjs",
"build-pack": "yarn build && fncts-pack mjs"
},
"dependencies": {
"@0x706b/eslint-plugin-align-assignments": "^0.1.2",
"@0x706b/eslint-plugin-module-specifier-extensions": "^0.1.10",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "9.7.0",
"@fncts/codegen": "workspace:*",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/experimental-utils": "^5.62.0",
"@typescript-eslint/parser": "^7.16.1",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-simple-import-sort": "^12.1.1"
"eslint-plugin-simple-import-sort": "^12.1.1",
"typescript-eslint": "^7.16.1"
},
"peerDependencies": {
"eslint": "^9.6.0"
},
"devDependencies": {
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.7.0",
"@fncts/config": "workspace:*",
"@types/eslint__js": "^8.42.3",
"typescript-eslint": "^7.16.1"
"@types/eslint__js": "^8.42.3"
},
"exports": {
".": {
"import": "./index.js"
"import": "./eslint.config.js"
},
"./*": {
"import": "./*.js"
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ __metadata:
languageName: node
linkType: hard

"@eslint/js@npm:9.7.0, @eslint/js@npm:^9.7.0":
"@eslint/js@npm:9.7.0":
version: 9.7.0
resolution: "@eslint/js@npm:9.7.0"
checksum: 10/b56b9fdec705f2cefae3a6d9d4227c4c28c5cbdbd8849c7997c357cabd4a729cee4445ddb43bb1423fbeb2280a119ced4d0819be8749d107c511e9d81dfe863a
Expand Down Expand Up @@ -1224,7 +1224,7 @@ __metadata:
"@0x706b/eslint-plugin-module-specifier-extensions": "npm:^0.1.10"
"@eslint/compat": "npm:^1.1.1"
"@eslint/eslintrc": "npm:^3.1.0"
"@eslint/js": "npm:^9.7.0"
"@eslint/js": "npm:9.7.0"
"@fncts/codegen": "workspace:*"
"@fncts/config": "workspace:*"
"@types/eslint__js": "npm:^8.42.3"
Expand Down

0 comments on commit 0bc7ae5

Please sign in to comment.