Skip to content

Commit

Permalink
chore: update eslint and prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkChampagne17 committed Dec 29, 2023
1 parent 598b992 commit 155e7ec
Show file tree
Hide file tree
Showing 22 changed files with 1,249 additions and 384 deletions.
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"cSpell.words": ["nameof", "pinkchampagne"],
"eslint.experimental.useFlatConfig": true,
"eslint.workingDirectories": [
{
"mode": "auto"
}
]
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "git",
"url": "https://github.com/p-toy-factory/ts-nameof-proxy"
},
"packageManager": "pnpm@8.7.5",
"packageManager": "pnpm@8.13.1",
"scripts": {
"prepare": "husky install",
"check": "beachball check",
Expand All @@ -17,8 +17,9 @@
"devDependencies": {
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@pinkchampagne/prettier-config": "^1.0.0",
"beachball": "^2.37.0",
"husky": "^8.0.1",
"prettier": "^2.7.1"
"prettier": "^3.1.1"
}
}
5 changes: 0 additions & 5 deletions packages/eslint-config-tnp/README.md

This file was deleted.

42 changes: 0 additions & 42 deletions packages/eslint-config-tnp/flat-config/base.js

This file was deleted.

14 changes: 0 additions & 14 deletions packages/eslint-config-tnp/flat-config/browser.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/eslint-config-tnp/flat-config/index.js

This file was deleted.

11 changes: 0 additions & 11 deletions packages/eslint-config-tnp/index.js

This file was deleted.

20 changes: 0 additions & 20 deletions packages/eslint-config-tnp/package.json

This file was deleted.

24 changes: 0 additions & 24 deletions packages/eslint-config-tnp/typescript.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/prettier-config/index.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions packages/prettier-config/package.json

This file was deleted.

6 changes: 0 additions & 6 deletions packages/ts-nameof-proxy/.eslintrc.cjs

This file was deleted.

13 changes: 13 additions & 0 deletions packages/ts-nameof-proxy/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { buildConfig } = require("eslint-config-pcp");

/** @type {import("eslint").Linter.FlatConfig[]} */
module.exports = (async() => {
return [
{
files: ["src/**/*.ts"],
},
...(await buildConfig({
perfectionist: false, // Occur error in VS Code
})),
]
})();
2 changes: 1 addition & 1 deletion packages/ts-nameof-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@typescript-eslint/parser": "^6.7.0",
"babel-jest": "^29.7.0",
"eslint": "^8.49.0",
"eslint-config-tnp": "workspace:*",
"eslint-config-pcp": "^2.0.0-beta.1",
"jest": "^29.7.0",
"rimraf": "^5.0.1",
"rollup": "^3.29.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-nameof-proxy/src/name-of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function nameOf<T>(obj: T, selector: NameSelector<T>): string;

export function nameOf<T>(
objOrSelector: T | NameSelector<T>,
selectorOrNil?: NameSelector<T>
selectorOrNil?: NameSelector<T>,
): string {
// @ts-ignore
const names = namesOf(objOrSelector, selectorOrNil);
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-nameof-proxy/src/names-of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function namesOf<T>(obj: T, selector: NameSelector<T>): string[];

export function namesOf<T>(
objOrSelector: T | NameSelector<T>,
selectorOrNil?: NameSelector<T>
selectorOrNil?: NameSelector<T>,
): string[] {
return pathsOf(objOrSelector, selectorOrNil).map(last);
}
2 changes: 1 addition & 1 deletion packages/ts-nameof-proxy/src/path-of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function pathOf<T>(obj: T, selector?: NameSelector<T>): string[];

export function pathOf<T>(
objOrSelector: T | NameSelector<T>,
selectorOrNil?: NameSelector<T>
selectorOrNil?: NameSelector<T>,
): string[] {
return pathsOf(objOrSelector, selectorOrNil)[0] ?? [];
}
2 changes: 1 addition & 1 deletion packages/ts-nameof-proxy/src/path-string-of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function pathStringOf<T>(obj: T, selector: NameSelector<T>): string;

export function pathStringOf<T>(
objOrSelector: T | NameSelector<T>,
selectorOrNil?: NameSelector<T>
selectorOrNil?: NameSelector<T>,
): string {
// @ts-ignore
const separatedPath = pathStringsOf(objOrSelector, selectorOrNil);
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-nameof-proxy/src/path-strings-of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function pathStringsOf<T>(obj: T, selector: NameSelector<T>): string[];

export function pathStringsOf<T>(
objOrSelector: T | NameSelector<T>,
selectorOrNil?: NameSelector<T>
selectorOrNil?: NameSelector<T>,
): string[] {
return pathsOf(objOrSelector, selectorOrNil).map(mapper);
}
Expand Down
11 changes: 6 additions & 5 deletions packages/ts-nameof-proxy/src/paths-of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function pathsOf<T>(obj: T, selector?: NameSelector<T>): string[][];

export function pathsOf<T>(
objOrSelector: T | NameSelector<T>,
selectorOrNil?: NameSelector<T>
selectorOrNil?: NameSelector<T>,
): string[][] {
const paths: string[][] = [];
const handler = generateProxyHandler(paths, true);
Expand All @@ -27,14 +27,15 @@ const emptyObj = Object.freeze({});

function generateProxyHandler(
paths: string[][],
isFirst: boolean
// eslint-disable-next-line @typescript-eslint/ban-types
): ProxyHandler<Object> {
isFirst: boolean,
): ProxyHandler<object> {
return {
get(_target, property, receiver) {
if (typeof property === "symbol") {
// Changing the type of the error is breaking change
// eslint-disable-next-line unicorn/prefer-type-error
throw new Error(
`ts-nameof-proxy: The path cannot contain ${property.toString()}.`
`ts-nameof-proxy: The path cannot contain ${property.toString()}.`,
);
}
if (isFirst) {
Expand Down
Loading

0 comments on commit 155e7ec

Please sign in to comment.