Skip to content

Commit

Permalink
build: fixed eslint and types issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AlansCodeLog committed Nov 15, 2024
1 parent 8dbfe54 commit 1e2f4a3
Show file tree
Hide file tree
Showing 10 changed files with 247 additions and 66 deletions.
1 change: 1 addition & 0 deletions demo/src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { ConditionNode, ExpressionNode, GroupNode } from "@witchcraft/expre

declare module "*.vue" {

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
const component: DefineComponent<{}, {}, any>

export default component
Expand Down
35 changes: 13 additions & 22 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
import { allFileTypes, tsEslintConfig, vueConfig } from "@alanscodelog/eslint-config"
export default tsEslintConfig( // this is just a re-export of tsEslint.config
import { allFileTypes,tsEslintConfig, vueConfig } from "@alanscodelog/eslint-config"

export default tsEslintConfig(
// https://github.com/AlansCodeLog/eslint-config
...vueConfig,
{
files: [`**/*.{${allFileTypes.join(",")}}`],
// experimentalUseProjectService is getting overloaded
languageOptions: {
parserOptions: {
// eslint-disable-next-line camelcase
EXPERIMENTAL_useProjectService: false,
project: "./tsconfig.eslint.json",
},
},
ignores: [
// ...
],
rules: {
"jsdoc/check-tag-names": ["warn", {
definedTags: [
"RequiresSet",
"experimental"
]
definedTags: ["experimental", "RequiresSet"],
}],
},
},
Expand All @@ -29,9 +15,14 @@ export default tsEslintConfig( // this is just a re-export of tsEslint.config
rules: {
"@typescript-eslint/explicit-function-return-type": "off"
}
},
{
languageOptions: {
parserOptions: {
projectService: {
defaultProject: "./tsconfig.eslint.json",
}
}
},
}
// RULE LINKS
// Eslint: https://eslint.org/docs/rules/
// Typescript: https://typescript-eslint.io/rules/
// Vue: https://eslint.vuejs.org/rules/
)
233 changes: 219 additions & 14 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
},
"scripts": {
"debug": "ts-node -r tsconfig-paths/register -T --esm",
"build": "vite build",
"build": "vite build && pnpm build:types",
"build:dev": "vite build --mode development",
"build:watch": "vite build --watch --mode production",
"build:types": "tsc -p tsconfig.types.json --emitDeclarationOnly && npm run build:types:fix",
"build:types": "tsc -p tsconfig.types.json --emitDeclarationOnly && pnpm build:types:fix",
"build:types:fix": "tsc-alias -p tsconfig.types.json --debug",
"lint:eslint": "eslint \"{src,tests,demo/src}/**/*.{cjs,js,ts,vue}\" \"*.{cjs,js,ts}\" --max-warnings=1 --report-unused-disable-directives",
"lint:eslint": "eslint \"src/**/*.{cjs,js,ts,vue}\" \"*.{cjs,js,ts}\" --max-warnings=1 --report-unused-disable-directives",
"lint:types": "tsc --noEmit --pretty -p tsconfig.types.json",
"lint:commits": "commitlint --from $(git rev-list --max-parents=0 HEAD) --to HEAD --verbose",
"lint:imports": "madge --circular --extensions ts ./src",
Expand Down Expand Up @@ -114,7 +114,8 @@
},
"pnpm": {
"overrides": {
"vue": "^3.4.26"
"vue": "^3.4.26",
"eslint":"=9.12.0"
}
},
"author": "Alan <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion src/defaults/Stringifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class Stringifier implements IStringifier {
try {
res = this.stringify(entry)
return res
} catch (e) {
} catch (_e) {
// ignore
}
const type = typeof entry
Expand Down
2 changes: 1 addition & 1 deletion src/types/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface RecursiveRecord {
* @template TValue **@internal** Captures the type of the context value.
*/

export type Context<TValue extends {} = any> = {
export type Context<TValue extends object = any> = {
type: "context"
/** Where the context object is stored. */
value: TValue
Expand Down
2 changes: 1 addition & 1 deletion src/types/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export type PickManager<
TKeys extends keyof TManager[TType],
TManager extends Manager = Manager,
> =
{[k in TType]: Pick<TManager[TType], TKeys> }
Record<TType, Pick<TManager[TType], TKeys>>

export type PickManagerHooks<T extends Manager["hooks"]> = {
hooks?: T
Expand Down
9 changes: 4 additions & 5 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
// Here partly because eslint tends to think vue files aren't included even when they explicitly are
// also here because I want to lint configs as well, but including them in the regular tsconfig can cause problems
"extends": "./tsconfig.json",
"extends": "@alanscodelog/tsconfigs",
"compilerOptions": {
"outDir": "dist",
},
"include": [
"**/*",
"*"
"demo/**/*.ts",
"demo/**/*.vue",
"tests/**/*.ts",
]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"include": [
"src/**/*.ts",
"src/**/*.js",
"src/**/*.vue"
"src/**/*.vue",
],
"exclude": [],
"tsc-alias": {
Expand Down
Loading

0 comments on commit 1e2f4a3

Please sign in to comment.