Skip to content

Commit

Permalink
Merge pull request #13 from js-tool-pack/eslint-v9
Browse files Browse the repository at this point in the history
Eslint v9
  • Loading branch information
mengxinssfd authored Jun 18, 2024
2 parents 5a55957 + ea2aa11 commit 919cca4
Show file tree
Hide file tree
Showing 28 changed files with 7,082 additions and 5,593 deletions.
20 changes: 0 additions & 20 deletions .eslintignore

This file was deleted.

48 changes: 0 additions & 48 deletions .eslintrc.js

This file was deleted.

42 changes: 21 additions & 21 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
module.exports = {
// 一行最多 100 字符
printWidth: 100,
// 使用 2 个空格缩进
tabWidth: 2,
// 不使用缩进符使用空格
useTabs: false,
// 行尾需要有分号
semi: true,
// 使用单引号
singleQuote: true,
// 根据显示样式决定 html 要不要折行
htmlWhitespaceSensitivity: 'css',
// 对象的 key 仅在必要时用引号
quoteProps: 'as-needed',
// jsx 不使用单引号,而使用双引号
jsxSingleQuote: false,
// 尾随逗号
trailingComma: 'all',
// 大括号内的首尾需要空格
bracketSpacing: true,
// 标签的反尖括号需要换行
bracketSameLine: true,
// 箭头函数,只有一个参数的时候,也需要括号
arrowParens: 'always',
// 每个文件格式化的范围是文件的全部内容
rangeStart: 0,
rangeEnd: Infinity,
// 使用默认的折行标准 不会更改 markdown 文本中的换行
proseWrap: 'preserve',
// 尾随逗号
trailingComma: 'all',
// 大括号内的首尾需要空格
bracketSpacing: true,
// 不需要写文件开头的 @prettier
requirePragma: false,
// 不需要自动在文件开头插入 @prettier
insertPragma: false,
// 使用默认的折行标准 不会更改 markdown 文本中的换行
proseWrap: 'preserve',
// 根据显示样式决定 html 要不要折行
htmlWhitespaceSensitivity: 'css',
rangeEnd: Infinity,
// 使用单引号
singleQuote: true,
// 换行符使用 auto
endOfLine: 'auto',
// 一行最多 100 字符
printWidth: 100,
// 不使用缩进符使用空格
useTabs: false,
// 每个文件格式化的范围是文件的全部内容
rangeStart: 0,
// 使用 2 个空格缩进
tabWidth: 2,
// 行尾需要有分号
semi: true,
};
10 changes: 5 additions & 5 deletions __tests__/dom.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expectError, expectType } from './utils';
import type { SettableDOMProps, SettableDOMStyle } from '../src';
import { expectError, expectType } from './utils';

describe('dom', () => {
test('SettableProps', () => {
Expand All @@ -8,14 +8,14 @@ describe('dom', () => {
// @ts-expect-error
expectError<T>({ id: '' });

expectType<SettableDOMProps<HTMLAnchorElement>>({ id: '', className: '', href: '' });
expectType<SettableDOMProps<HTMLAnchorElement>>({ className: '', href: '', id: '' });
});
test('SettableProps', () => {
type T = SettableDOMProps<HTMLDivElement>;
expectType<T>({ id: '', className: '' });
expectType<T>({ className: '', id: '' });
// @ts-expect-error
expectError<T>({ id: '', className: '', href: '' });
expectError<T>({ className: '', href: '', id: '' });

expectType<SettableDOMProps<HTMLAnchorElement>>({ id: '', className: '', href: '' });
expectType<SettableDOMProps<HTMLAnchorElement>>({ className: '', href: '', id: '' });
});
});
18 changes: 9 additions & 9 deletions __tests__/object-path.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { expectError, expectType } from './utils';
import type {
PathOf,
TransferPath,
ValueMatchingPath,
TransferPathOf,
TransferPath,
TypeOfPath,
ValueMatchingPath,
PathUnion,
PathOf,
} from '../src';
import { expectError, expectType } from './utils';
const ab: 'a' | 'b' = Math.random() > 0.5 ? 'a' : 'b';
describe('object-path', function () {
test('TypeOfPath', () => {
Expand Down Expand Up @@ -113,16 +113,16 @@ describe('object-path', function () {
expectError<PathUnion<{ a: number }>>('a' as 'a' | 'b');
expectType<PathUnion<{ a: number; b: string }>>('a' as 'a' | 'b');

type T = PathUnion<{ a: number; b: string; bb: { c: string; cc: { d: string } } }>;
expectType<T>('a' as 'a' | 'b' | 'bb' | 'bb.c' | 'bb.cc' | 'bb.cc.d');
type T = PathUnion<{ bb: { cc: { d: string }; c: string }; a: number; b: string }>;
expectType<T>('a' as 'bb.cc.d' | 'bb.cc' | 'bb.c' | 'bb' | 'a' | 'b');

type T3 = PathUnion<{
b: { cc: { dd: string }; c: boolean };
bb: { cc: { d: string }; c: string };
a: number;
b: { c: boolean; cc: { dd: string } };
bb: { c: string; cc: { d: string } };
}>;
expectType<T3>(
'a' as 'a' | 'b' | 'b.c' | 'b.cc' | 'b.cc.dd' | 'bb' | 'bb.c' | 'bb.cc' | 'bb.cc.d',
'a' as 'b.cc.dd' | 'bb.cc.d' | 'bb.cc' | 'b.cc' | 'bb.c' | 'b.c' | 'bb' | 'a' | 'b',
);
});
});
Loading

0 comments on commit 919cca4

Please sign in to comment.