Skip to content

Commit fa1a84b

Browse files
committed
main 🧊 add new eslint core
1 parent 7193185 commit fa1a84b

File tree

51 files changed

+2380
-962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2380
-962
lines changed

‎.eslintrc.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎.prettierrc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
const { prettier } = require('@siberiacancode/prettier');
2-
module.exports = prettier;
1+
import { prettier } from '@siberiacancode/prettier';
2+
3+
export default prettier;

‎README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,9 @@ the largest and most useful hook library
44

55
## 🦉 Philosophy
66

7-
**🚀 React Use** this is a library that will allow you to easy and simple to use React hooks. Unlike its competitors, this package takes into account the features of React and also contains a huge number of useful hooks.
7+
**🚀 React Use** this is a library that will allow you to easy and simple to use React hooks. Unlike its competitors, this package takes into account the features of React and also contains a huge number of useful hooks.
88

99
## Features
1010

1111
- **TypeScript support out of the box** - full typed package
1212
- **SSR** - package work with server side render
13-
14-
15-
16-
17-
18-
19-

‎docs/.vitepress/config.mts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export default async () => {
1212

1313
if (!category) {
1414
categoryItems.push({ text: hookItem.category, items: [hookItem] });
15-
} else {
15+
}
16+
else {
1617
category.items!.push(hookItem);
1718
}
1819

@@ -44,7 +45,6 @@ export default async () => {
4445

4546
if (pageData.relativePath.includes('hooks')) {
4647
pageData.title = pageData.params?.name;
47-
return;
4848
}
4949
},
5050
head: [
@@ -65,7 +65,8 @@ export default async () => {
6565
pattern: ({ filePath, params }) => {
6666
if (filePath.includes('hooks') && params?.name) {
6767
return `https://github.com/siberiacancode/reactuse/blob/main/src/hooks/${params.name}/${params.name}.ts`;
68-
} else {
68+
}
69+
else {
6970
return `https://github.com/siberiacancode/reactuse/blob/main/docs/${filePath}`;
7071
}
7172
},

‎docs/functions/hooks/[name].md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ import { {{ $params.name }} } from '@siberiacancode/reactuse';
3232
## Contributors
3333

3434
<Contributors :hook="$params.name" />
35-

‎docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ Install **🚀 React Use** with [npm](https://www.npmjs.com/) or [yarn](https://
1414
$ npm i @siberiacancode/reactuse --save
1515
# or
1616
$ yarn add @siberiacancode/reactuse
17-
```
17+
```

‎docs/src/components/api.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
<script setup lang="ts">
22
import type { Spec } from 'comment-parser';
3+
34
import { isDefaultType } from '../utils/isDefaultType';
45
56
const props = defineProps<{
67
apiParameters: Spec[];
78
}>();
89
9-
type Group = {
10+
interface Group {
1011
id: number;
1112
parameters: Spec[];
1213
returns: Spec | null;
13-
};
14+
}
1415
1516
let groupIndex = 0;
1617
const groups: Group[] = [{ id: groupIndex, parameters: [], returns: null }];
1718
1819
props.apiParameters.forEach((parameter, index) => {
1920
if (parameter.tag === 'overload') {
20-
const isFirstOverload =
21-
props.apiParameters.findIndex((parameter) => parameter.tag === 'overload') === index;
21+
const isFirstOverload
22+
= props.apiParameters.findIndex((parameter) => parameter.tag === 'overload') === index;
2223
if (!isFirstOverload) {
2324
groupIndex++;
2425
groups.push({ id: groupIndex, parameters: [], returns: null });
@@ -37,7 +38,9 @@ props.apiParameters.forEach((parameter, index) => {
3738

3839
<template>
3940
<div v-for="group in groups" :key="group.id">
40-
<h3 v-if="group.parameters.length">Parameters</h3>
41+
<h3 v-if="group.parameters.length">
42+
Parameters
43+
</h3>
4144
<table v-if="group.parameters.length">
4245
<thead>
4346
<tr>

‎docs/src/components/demo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup>
22
import { createElement } from 'react';
33
import { createRoot } from 'react-dom/client';
4-
import { shallowRef, computed, onMounted, onUnmounted, defineAsyncComponent } from 'vue';
4+
import { computed, onMounted, onUnmounted, shallowRef } from 'vue';
55
66
const props = defineProps({
77
hook: {

‎docs/src/components/meta.vue

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
const props = defineProps({
2+
defineProps({
33
lastModified: {
44
type: Number
55
},
@@ -16,30 +16,37 @@ const timeAgo = (timestamp, locale = 'en') => {
1616
const days = Math.floor(hours / 24);
1717
const months = Math.floor(days / 30);
1818
const years = Math.floor(months / 12);
19-
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
19+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });
2020
2121
if (years > 0) {
22-
value = rtf.format(0 - years, "year");
23-
} else if (months > 0) {
24-
value = rtf.format(0 - months, "month");
25-
} else if (days > 0) {
26-
value = rtf.format(0 - days, "day");
27-
} else if (hours > 0) {
28-
value = rtf.format(0 - hours, "hour");
29-
} else if (minutes > 0) {
30-
value = rtf.format(0 - minutes, "minute");
31-
} else {
32-
value = rtf.format(0 - diff, "second");
22+
value = rtf.format(0 - years, 'year');
23+
}
24+
else if (months > 0) {
25+
value = rtf.format(0 - months, 'month');
26+
}
27+
else if (days > 0) {
28+
value = rtf.format(0 - days, 'day');
29+
}
30+
else if (hours > 0) {
31+
value = rtf.format(0 - hours, 'hour');
32+
}
33+
else if (minutes > 0) {
34+
value = rtf.format(0 - minutes, 'minute');
35+
}
36+
else {
37+
value = rtf.format(0 - diff, 'second');
3338
}
3439
return value;
35-
}
40+
};
3641
</script>
3742

3843
<template>
3944
<div class="meta">
4045
<template v-if="category">
4146
<div>Category</div>
42-
<div><code>{{ category }}</code></div>
47+
<div>
48+
<code>{{ category }}</code>
49+
</div>
4350
</template>
4451
<ClientOnly v-if="lastModified">
4552
<div>Last Changed</div>
@@ -50,11 +57,11 @@ const timeAgo = (timestamp, locale = 'en') => {
5057

5158
<style scoped>
5259
.meta {
53-
font-size: .875rem;
60+
font-size: 0.875rem;
5461
line-height: 1.25rem;
5562
display: grid;
5663
grid-template-columns: 100px auto;
57-
gap: .5rem;
64+
gap: 0.5rem;
5865
align-items: flex-start;
5966
margin-top: 1rem;
6067
margin-bottom: 2rem;

‎eslint.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { eslint } from '@siberiacancode/eslint';
2+
3+
export default eslint(
4+
{
5+
typescript: true,
6+
react: true,
7+
jsx: true
8+
},
9+
{
10+
name: 'hooks',
11+
files: ['**/hooks/**/*.ts'],
12+
rules: {
13+
'jsdoc/no-defaults': 'off'
14+
}
15+
},
16+
{
17+
name: 'demo',
18+
files: ['**/*.demo.tsx'],
19+
rules: {
20+
'no-alert': 'off'
21+
}
22+
},
23+
{
24+
name: 'md',
25+
files: ['**/*.md'],
26+
rules: {
27+
'style/max-len': 'off'
28+
}
29+
},
30+
{
31+
name: 'docs',
32+
files: ['**/docs/**/*.ts'],
33+
rules: {
34+
'regexp/no-super-linear-backtracking': 'off'
35+
}
36+
}
37+
);

0 commit comments

Comments
 (0)