Skip to content

Commit 57a44ea

Browse files
committed
♻️ Improve DX, cleanup structure (#94)
Resolves #93
1 parent d8205cb commit 57a44ea

20 files changed

+1417
-328
lines changed

Diff for: .eslintrc.cjs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** @type {import('eslint').ESLint.ConfigData} */
2+
module.exports = {
3+
root: true,
4+
extends: ['@mheob/eslint-config'],
5+
rules: {
6+
'unicorn/no-array-reduce': 'off',
7+
'unicorn/prefer-module': 'off',
8+
'unicorn/prefer-object-from-entries': 'off',
9+
},
10+
};

Diff for: .eslintrc.json

-14
This file was deleted.

Diff for: .github/renovate.json

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
23
"extends": ["config:base", ":preserveSemverRanges", "group:allNonMajor"],
34
"assignees": ["mheob"],
45
"reviewers": ["mheob"],
56
"labels": ["dependencies"],
67
"schedule": ["before 3am on Friday"],
7-
"npm": { "stabilityDays": 5 }
8+
"npm": { "stabilityDays": 5 },
9+
"commitMessagePrefix": "⬆️",
10+
"commitMessageAction": "Upgrade",
11+
"packageRules": [
12+
{
13+
"updateTypes": ["pin"],
14+
"commitMessagePrefix": "📌",
15+
"commitMessageAction": "Pin"
16+
},
17+
{
18+
"updateTypes": ["rollback"],
19+
"commitMessagePrefix": "⬇️",
20+
"commitMessageAction": "Downgrade"
21+
}
22+
]
823
}

Diff for: .gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
*.vsix
2-
32
snippets
4-
5-
node_modules/
3+
node_modules

Diff for: .prettierrc.cjs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/** @type {import('prettier').Config} */
2+
module.exports = {
3+
...require('@mheob/prettier-config'),
4+
overrides: [
5+
{
6+
files: ['*.md'],
7+
options: {
8+
parser: 'markdown',
9+
printWidth: 999,
10+
},
11+
},
12+
],
13+
};

Diff for: .prettierrc.json

-14
This file was deleted.

Diff for: .vscode/settings.json

+1-10
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,5 @@
1313
"default": true,
1414
"MD024": false,
1515
"MD033": false
16-
},
17-
// Yarn berry
18-
"search.exclude": {
19-
"**/.yarn": true,
20-
"**/.pnp.*": true
21-
},
22-
"eslint.nodePath": ".yarn/sdks",
23-
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
24-
"typescript.enablePromptUseWorkspaceTsdk": true,
25-
"typescript.tsdk": ".yarn/sdks/typescript/lib"
16+
}
2617
}

Diff for: .whitesource

-12
This file was deleted.

Diff for: README.md

+32-35
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,34 @@ export default MyDynamicComponentName
3737

3838
### Common
3939

40-
| Trigger | Content | Only for languages |
41-
| :------- | :---------------------------------------- | :----------------- |
42-
| `dtid⇥` | adds `data-testid="…"` | `.jsx`, `.tsx` |
43-
| `forIn⇥` | for ... in loop `for(const … in …) { … }` | |
44-
| `forOf⇥` | for ... of loop `for(const … of …) { … }` | |
40+
| Trigger | Content | Only for languages |
41+
| :------ | :--------------------- | :----------------- |
42+
| `dtid⇥` | adds `data-testid="…"` | `.jsx`, `.tsx` |
4543

4644
### Console
4745

48-
| Trigger | Content |
49-
| :-------------- | :------------------------------- |
50-
| `consoleError` | console error `console.error(…)` |
51-
| `consoleInfo` | console info `console.info(…)` |
52-
| `consoleLog` | console log `console.log(…)` |
53-
| `consoleWarn` | console warn `console.warn(…)` |
46+
| Trigger | Content |
47+
| :----------- | :------------------------------- |
48+
| `consError` | console error `console.error(…)` |
49+
| `consInfo` | console info `console.info(…)` |
50+
| `consLog` | console log `console.log(…)` |
51+
| `consWarn` | console warn `console.warn(…)` |
5452

5553
### Export and Import
5654

57-
| Trigger | Content | Only for languages |
58-
| :-------------------- | :-------------------------------------------------------------- | :----------------- |
59-
| `exportAllFrom` | exports all from module `export * from '…'` | |
60-
| `exportAs` | exports all as alias from module `export … as … from '…'` | |
61-
| `exportConst` | exports const `export const … = …` | |
62-
| `exportDefault⇥` | exports default `export default …` | |
63-
| `importFrom` | imports entire module `import … from '…'` | |
64-
| `importAllFrom` | imports all as alias from module `import … as … from '…'` | |
65-
| `importDestructured` | imports only destructed part of module `import { … } from '…'` | |
66-
| `importFileOnly` | imports entire module without module name `import '…'` | |
67-
| `importReact` | import the `React` module `import React from 'react'` | `.jsx`, `.tsx` |
68-
| `importReactDom` | import the `ReactDOM` module `import ReactDOM from 'react-dom'` | `.jsx`, `.tsx` |
69-
| `importType` | import only the type from module `import type { … } from '…'` | `.ts`, `.tsx` |
55+
| Trigger | Content | Only for languages |
56+
| :----------------- | :-------------------------------------------------------------- | :----------------- |
57+
| `expAllFrom` | exports all from module `export * from '…'` | |
58+
| `expAs` | exports all as alias from module `export … as … from '…'` | |
59+
| `expConst` | exports const `export const … = …` | |
60+
| `exportDefault⇥` | exports default `export default …` | |
61+
| `impFrom` | imports entire module `import … from '…'` | |
62+
| `impAllFrom` | imports all as alias from module `import … as … from '…'` | |
63+
| `impDestructured` | imports only destructed part of module `import { … } from '…'` | |
64+
| `impFileOnly` | imports entire module without module name `import '…'` | |
65+
| `impReact` | import the `React` module `import React from 'react'` | `.jsx`, `.tsx` |
66+
| `impReactDom` | import the `ReactDOM` module `import ReactDOM from 'react-dom'` | `.jsx`, `.tsx` |
67+
| `impType` | import only the type from module `import type { … } from '…'` | `.ts`, `.tsx` |
7068

7169
### Functions
7270

@@ -87,17 +85,16 @@ export default MyDynamicComponentName
8785

8886
### React Hooks
8987

90-
| Trigger | Hook |
91-
| :---------------- | :--------------------------------------------------------------------------------- |
92-
| `useCallback⇥` | create `useCallback` hook |
93-
| `useContext⇥` | create `useContext` hook |
94-
| `useEffect⇥` | create `useEffect` hook |
95-
| `useMemo⇥` | create `useMemo` hook |
96-
| `useReducer⇥` | create `useReducer` hook |
97-
| `useRef⇥` | create `useRef` hook |
98-
| `useRouter⇥` | create `useRouter` hook |
99-
| `useState⇥` | create `useState` hook |
100-
| `useTranslation⇥` | create `useTranslation` hook (part of [react.i18next](https://react.i18next.com/)) |
88+
| Trigger | Hook |
89+
| :------------- | :------------------------ |
90+
| `useCallback⇥` | create `useCallback` hook |
91+
| `useContext⇥` | create `useContext` hook |
92+
| `useEffect⇥` | create `useEffect` hook |
93+
| `useMemo⇥` | create `useMemo` hook |
94+
| `useReducer⇥` | create `useReducer` hook |
95+
| `useRef⇥` | create `useRef` hook |
96+
| `useRouter⇥` | create `useRouter` hook |
97+
| `useState⇥` | create `useState` hook |
10198

10299
## Snippets List for Markdown
103100

Diff for: package.json

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vscode-snippets",
33
"displayName": "Snippets for Next.js, React in TypeScript",
4-
"version": "1.3.0",
4+
"version": "2.0.0",
55
"private": true,
66
"description": "Snippets for the development with Next.js, React in a TypeScript environment.",
77
"categories": [
@@ -25,12 +25,12 @@
2525
"license": "MIT",
2626
"publisher": "mheob",
2727
"scripts": {
28-
"build": "pnpm clean && ts-node scripts/generate-snippet-files.ts",
28+
"build": "pnpm clean && ts-node scripts/generateSnippetFiles.ts",
2929
"clean": "rimraf snippets",
30-
"deploy": "pnpm build && vsce package --no-dependencies",
30+
"deploy": "pnpm build && pnpm exec vsce package --no-dependencies",
3131
"format": "prettier --write **/*.{ts,json,md,yml} --ignore-path .gitignore",
32-
"prepare": "husky install",
3332
"lint": "eslint . --ext .ts",
33+
"prepare": "husky install",
3434
"vscode:prepublish": "pnpm build"
3535
},
3636
"contributes": {
@@ -63,24 +63,25 @@
6363
"package.json": "pnpm dlx sort-package-json"
6464
},
6565
"devDependencies": {
66-
"@types/node": "^17.0.35",
67-
"@typescript-eslint/eslint-plugin": "^5.26.0",
68-
"@typescript-eslint/parser": "^5.26.0",
69-
"eslint": "^8.16.0",
70-
"eslint-config-prettier": "^8.5.0",
71-
"eslint-plugin-prettier": "^4.0.0",
72-
"eslint-plugin-unicorn": "^43.0.0",
66+
"@mheob/eslint-config": "^2.1.0",
67+
"@mheob/prettier-config": "^1.4.0",
68+
"@types/node": "^18.7.14",
69+
"@typescript-eslint/eslint-plugin": "^5.36.1",
70+
"@typescript-eslint/parser": "^5.36.1",
71+
"eslint": "^8.23.0",
7372
"husky": "^8.0.1",
74-
"lint-staged": "^13.0.0",
75-
"prettier": "^2.6.2",
76-
"prettier-plugin-jsdoc": "^0.4.0",
73+
"lint-staged": "^13.0.3",
74+
"prettier": "^2.7.1",
7775
"rimraf": "^3.0.2",
78-
"ts-node": "^10.8.0",
79-
"typescript": "^4.7.2",
80-
"vsce": "^2.8.0"
76+
"ts-node": "^10.9.1",
77+
"typescript": "^4.8.2",
78+
"vsce": "^2.11.0"
8179
},
8280
"engines": {
8381
"vscode": "^1.65.0"
8482
},
85-
"icon": "images/logo.png"
83+
"icon": "images/logo.png",
84+
"sponsor": {
85+
"url": "https://github.com/sponsors/mheob"
86+
}
8687
}

0 commit comments

Comments
 (0)