@krutoo/presets 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/eslint.d.ts +4 -0
- package/dist/eslint.js +125 -0
- package/dist/eslint.js.map +1 -0
- package/dist/prettier.d.ts +4 -0
- package/dist/prettier.js +29 -0
- package/dist/prettier.js.map +1 -0
- package/package.json +72 -0
- package/public/tsconfig.build.json +16 -0
- package/public/tsconfig.check.json +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dmitriy Petrov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Presets
|
|
2
|
+
|
|
3
|
+
Set of presets for format/lint/test/build etc.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm add -D @krutoo/presets
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### ESLint
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// eslint.config.{js,ts}
|
|
17
|
+
import preset from '@krutoo/presets/eslint';
|
|
18
|
+
|
|
19
|
+
export default [
|
|
20
|
+
...preset,
|
|
21
|
+
// ...optionally your overrides and other configs
|
|
22
|
+
];
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Prettier
|
|
26
|
+
|
|
27
|
+
When using JS/TS:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// prettier.config.{js,ts}
|
|
31
|
+
export { default } from '@krutoo/presets/prettier';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
When using JSON:
|
|
35
|
+
|
|
36
|
+
```jsonc
|
|
37
|
+
// .prettierrc.json
|
|
38
|
+
"@krutoo/presets/prettier"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### TypeScript
|
|
42
|
+
|
|
43
|
+
For static analysis in your editor/IDE and for `tsc -p . --noEmit`:
|
|
44
|
+
|
|
45
|
+
```jsonc
|
|
46
|
+
// tsconfig.json
|
|
47
|
+
{
|
|
48
|
+
"extends": "@krutoo/presets/tsconfig.check.json",
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This preset will check all files in your project root, where `tsconfig.json` placed.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
For build your package via `tsc -p tsconfig.build.json`:
|
|
57
|
+
|
|
58
|
+
```jsonc
|
|
59
|
+
// tsconfig.build.json
|
|
60
|
+
{
|
|
61
|
+
"extends": "@krutoo/presets/tsconfig.build.json",
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This preset will try to build from `src` folder to `dist` folder.
|
|
66
|
+
|
|
67
|
+
### To Do
|
|
68
|
+
|
|
69
|
+
- `bin` to use like `npx presets --init --all` for automatically create config files
|
package/dist/eslint.d.ts
ADDED
package/dist/eslint.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { includeIgnoreFile } from '@eslint/compat';
|
|
3
|
+
import pluginJs from '@eslint/js';
|
|
4
|
+
import confusingBrowserGlobals from 'confusing-browser-globals';
|
|
5
|
+
import pluginJSDoc from 'eslint-plugin-jsdoc';
|
|
6
|
+
import pluginReact from 'eslint-plugin-react';
|
|
7
|
+
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
8
|
+
import { defineConfig } from 'eslint/config';
|
|
9
|
+
import globals from 'globals';
|
|
10
|
+
import tseslint from 'typescript-eslint';
|
|
11
|
+
|
|
12
|
+
// @todo сделать namespace с отдельными config'ами чтобы можно было точечно подключать?
|
|
13
|
+
// @todo сделать функцию с настройками вроде preset({ gitignore: false, react: false })?
|
|
14
|
+
const gitignorePath = path.resolve(process.cwd(), '.gitignore');
|
|
15
|
+
const configs = defineConfig([
|
|
16
|
+
// Global ignores
|
|
17
|
+
includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'),
|
|
18
|
+
// Basics
|
|
19
|
+
{
|
|
20
|
+
files: ['**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
languageOptions: {
|
|
24
|
+
globals: {
|
|
25
|
+
...globals.browser,
|
|
26
|
+
...globals.node,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
pluginJs.configs.recommended,
|
|
31
|
+
tseslint.configs.recommended,
|
|
32
|
+
{
|
|
33
|
+
rules: {
|
|
34
|
+
'object-shorthand': 'error',
|
|
35
|
+
'no-console': 'error',
|
|
36
|
+
eqeqeq: 'error',
|
|
37
|
+
'no-param-reassign': 'error',
|
|
38
|
+
'no-restricted-globals': ['error', { globals: confusingBrowserGlobals }],
|
|
39
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
40
|
+
'no-shadow': 'off',
|
|
41
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
42
|
+
'@typescript-eslint/no-empty-object-type': [
|
|
43
|
+
'error',
|
|
44
|
+
{
|
|
45
|
+
allowInterfaces: 'always',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
// CommonJS
|
|
51
|
+
{
|
|
52
|
+
files: ['**/*.{cjs,cts}'],
|
|
53
|
+
rules: {
|
|
54
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
// React
|
|
58
|
+
pluginReact.configs.flat.recommended,
|
|
59
|
+
pluginReact.configs.flat['jsx-runtime'],
|
|
60
|
+
{
|
|
61
|
+
settings: {
|
|
62
|
+
react: {
|
|
63
|
+
version: 'detect',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
rules: {
|
|
67
|
+
'react/prop-types': 'off',
|
|
68
|
+
'react/jsx-curly-brace-presence': 'warn',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
// React hooks
|
|
72
|
+
pluginReactHooks.configs.flat['recommended-latest'],
|
|
73
|
+
{
|
|
74
|
+
rules: {
|
|
75
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
76
|
+
'react-hooks/exhaustive-deps': [
|
|
77
|
+
'warn',
|
|
78
|
+
{
|
|
79
|
+
additionalHooks: '(useIsomorphicLayoutEffect)',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
// next rules are disabled because it downgrades DX of creating components
|
|
83
|
+
'react-hooks/immutability': 'off',
|
|
84
|
+
'react-hooks/refs': 'off',
|
|
85
|
+
'react-hooks/set-state-in-effect': 'off',
|
|
86
|
+
'react-hooks/use-memo': 'off',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
// JSDoc
|
|
90
|
+
pluginJSDoc.configs['flat/recommended'],
|
|
91
|
+
{
|
|
92
|
+
rules: {
|
|
93
|
+
'jsdoc/require-description-complete-sentence': 'warn',
|
|
94
|
+
'jsdoc/require-param': [
|
|
95
|
+
'warn',
|
|
96
|
+
{
|
|
97
|
+
checkDestructured: false,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
'jsdoc/check-param-names': [
|
|
101
|
+
'warn',
|
|
102
|
+
{
|
|
103
|
+
checkDestructured: false,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
'jsdoc/require-jsdoc': 'error',
|
|
107
|
+
'jsdoc/tag-lines': 'off',
|
|
108
|
+
// no types required in JSDoc because TS types is preferred
|
|
109
|
+
'jsdoc/require-param-type': 'off',
|
|
110
|
+
'jsdoc/require-property-type': 'off',
|
|
111
|
+
'jsdoc/require-returns-type': 'off',
|
|
112
|
+
'jsdoc/require-yields-type': 'off',
|
|
113
|
+
'jsdoc/require-throws-type': 'off',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
// no require JSDoc in tests
|
|
118
|
+
files: ['**/*.{test,spec}.{js,mjs,cjs,ts,jsx,tsx}'],
|
|
119
|
+
rules: {
|
|
120
|
+
'jsdoc/require-jsdoc': 'off',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
]);
|
|
124
|
+
export default configs;
|
|
125
|
+
//# sourceMappingURL=eslint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAA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import path from 'node:path';\nimport { includeIgnoreFile } from '@eslint/compat';\nimport pluginJs from '@eslint/js';\nimport confusingBrowserGlobals from 'confusing-browser-globals';\nimport pluginJSDoc from 'eslint-plugin-jsdoc';\nimport pluginReact from 'eslint-plugin-react';\nimport pluginReactHooks from 'eslint-plugin-react-hooks';\nimport { type Config, defineConfig } from 'eslint/config';\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\n\n// @todo сделать namespace с отдельными config'ами чтобы можно было точечно подключать?\n// @todo сделать функцию с настройками вроде preset({ gitignore: false, react: false })?\n\nconst gitignorePath = path.resolve(process.cwd(), '.gitignore');\n\nconst configs: Config[] = defineConfig([\n // Global ignores\n includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'),\n\n // Basics\n {\n files: ['**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'],\n },\n {\n languageOptions: {\n globals: {\n ...globals.browser,\n ...globals.node,\n },\n },\n },\n pluginJs.configs.recommended,\n tseslint.configs.recommended,\n {\n rules: {\n 'object-shorthand': 'error',\n 'no-console': 'error',\n eqeqeq: 'error',\n 'no-param-reassign': 'error',\n 'no-restricted-globals': ['error', { globals: confusingBrowserGlobals }],\n '@typescript-eslint/no-explicit-any': 'error',\n 'no-shadow': 'off',\n '@typescript-eslint/no-shadow': 'error',\n '@typescript-eslint/no-empty-object-type': [\n 'error',\n {\n allowInterfaces: 'always',\n },\n ],\n },\n },\n\n // CommonJS\n {\n files: ['**/*.{cjs,cts}'],\n rules: {\n '@typescript-eslint/no-require-imports': 'off',\n },\n },\n\n // React\n pluginReact.configs.flat.recommended!,\n pluginReact.configs.flat['jsx-runtime']!,\n {\n settings: {\n react: {\n version: 'detect',\n },\n },\n rules: {\n 'react/prop-types': 'off',\n 'react/jsx-curly-brace-presence': 'warn',\n },\n },\n\n // React hooks\n pluginReactHooks.configs.flat['recommended-latest'],\n {\n rules: {\n 'react-hooks/rules-of-hooks': 'error',\n 'react-hooks/exhaustive-deps': [\n 'warn',\n {\n additionalHooks: '(useIsomorphicLayoutEffect)',\n },\n ],\n\n // next rules are disabled because it downgrades DX of creating components\n 'react-hooks/immutability': 'off',\n 'react-hooks/refs': 'off',\n 'react-hooks/set-state-in-effect': 'off',\n 'react-hooks/use-memo': 'off',\n },\n },\n\n // JSDoc\n pluginJSDoc.configs['flat/recommended'],\n {\n rules: {\n 'jsdoc/require-description-complete-sentence': 'warn',\n 'jsdoc/require-param': [\n 'warn',\n {\n checkDestructured: false,\n },\n ],\n 'jsdoc/check-param-names': [\n 'warn',\n {\n checkDestructured: false,\n },\n ],\n 'jsdoc/require-jsdoc': 'error',\n 'jsdoc/tag-lines': 'off',\n\n // no types required in JSDoc because TS types is preferred\n 'jsdoc/require-param-type': 'off',\n 'jsdoc/require-property-type': 'off',\n 'jsdoc/require-returns-type': 'off',\n 'jsdoc/require-yields-type': 'off',\n 'jsdoc/require-throws-type': 'off',\n },\n },\n {\n // no require JSDoc in tests\n files: ['**/*.{test,spec}.{js,mjs,cjs,ts,jsx,tsx}'],\n rules: {\n 'jsdoc/require-jsdoc': 'off',\n },\n },\n]);\n\nexport default configs;\n"]}
|
package/dist/prettier.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
arrowParens: 'avoid',
|
|
3
|
+
bracketSpacing: true,
|
|
4
|
+
jsxSingleQuote: true,
|
|
5
|
+
printWidth: 100,
|
|
6
|
+
semi: true,
|
|
7
|
+
singleQuote: true,
|
|
8
|
+
tabWidth: 2,
|
|
9
|
+
trailingComma: 'all',
|
|
10
|
+
plugins: ['@trivago/prettier-plugin-sort-imports'],
|
|
11
|
+
// plugin sort imports:
|
|
12
|
+
importOrderSortSpecifiers: true,
|
|
13
|
+
importOrderSeparation: false,
|
|
14
|
+
importOrder: [
|
|
15
|
+
// builtin modules:
|
|
16
|
+
'^node:', // @todo как быть с deno:, npm:, bun: и тд?
|
|
17
|
+
// packages:
|
|
18
|
+
'^react',
|
|
19
|
+
'<THIRD_PARTY_MODULES>',
|
|
20
|
+
// project aliases:
|
|
21
|
+
'^#(.*)$',
|
|
22
|
+
// any other relative/absolute path that are not styles
|
|
23
|
+
'^[./]((?!.css$).)*$',
|
|
24
|
+
// styles
|
|
25
|
+
'\\.css$',
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
export default config;
|
|
29
|
+
//# sourceMappingURL=prettier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettier.js","sourceRoot":"","sources":["../src/prettier.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAW;IACrB,WAAW,EAAE,OAAO;IACpB,cAAc,EAAE,IAAI;IACpB,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,GAAG;IACf,IAAI,EAAE,IAAI;IACV,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,CAAC,uCAAuC,CAAC;IAElD,uBAAuB;IACvB,yBAAyB,EAAE,IAAI;IAC/B,qBAAqB,EAAE,KAAK;IAC5B,WAAW,EAAE;QACX,mBAAmB;QACnB,QAAQ,EAAE,2CAA2C;QAErD,YAAY;QACZ,QAAQ;QACR,uBAAuB;QAEvB,mBAAmB;QACnB,SAAS;QAET,uDAAuD;QACvD,qBAAqB;QAErB,SAAS;QACT,SAAS;KACV;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import type { Config } from 'prettier';\n\nconst config: Config = {\n arrowParens: 'avoid',\n bracketSpacing: true,\n jsxSingleQuote: true,\n printWidth: 100,\n semi: true,\n singleQuote: true,\n tabWidth: 2,\n trailingComma: 'all',\n plugins: ['@trivago/prettier-plugin-sort-imports'],\n\n // plugin sort imports:\n importOrderSortSpecifiers: true,\n importOrderSeparation: false,\n importOrder: [\n // builtin modules:\n '^node:', // @todo как быть с deno:, npm:, bun: и тд?\n\n // packages:\n '^react',\n '<THIRD_PARTY_MODULES>',\n\n // project aliases:\n '^#(.*)$',\n\n // any other relative/absolute path that are not styles\n '^[./]((?!.css$).)*$',\n\n // styles\n '\\\\.css$',\n ],\n};\n\nexport default config;\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@krutoo/presets",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"description": "Configs and other presets",
|
|
6
|
+
"author": "Dmitriy Petrov <dima.krutoo@yandex.ru>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"devEngines": {
|
|
9
|
+
"runtime": {
|
|
10
|
+
"name": "node",
|
|
11
|
+
"version": ">=24.14.0",
|
|
12
|
+
"onFail": "error"
|
|
13
|
+
},
|
|
14
|
+
"packageManager": {
|
|
15
|
+
"name": "npm",
|
|
16
|
+
"version": ">=10.9.3",
|
|
17
|
+
"onFail": "error"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"check": "tsc -p . --noEmit",
|
|
22
|
+
"fmt": "prettier . --write",
|
|
23
|
+
"build": "node scripts/build.ts"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/confusing-browser-globals": "^1.0.3",
|
|
27
|
+
"@types/node": "^24.12.2",
|
|
28
|
+
"eslint": "^9.39.4",
|
|
29
|
+
"typescript": "^6.0.2"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@eslint/compat": "^2.0.5",
|
|
33
|
+
"@eslint/js": "^9 || ^10",
|
|
34
|
+
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
|
|
35
|
+
"confusing-browser-globals": "^1.0.11",
|
|
36
|
+
"eslint": "^9 || ^10",
|
|
37
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
38
|
+
"eslint-plugin-react": "^7.37.5",
|
|
39
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
40
|
+
"prettier": "^3.8.2",
|
|
41
|
+
"typescript": "^5 || ^6",
|
|
42
|
+
"typescript-eslint": "^8.58.1"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"@eslint/js": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"eslint": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"typescript": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"prettier": {
|
|
55
|
+
"optional": true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=16"
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"dist",
|
|
63
|
+
"public"
|
|
64
|
+
],
|
|
65
|
+
"exports": {
|
|
66
|
+
"./eslint": "./dist/eslint.js",
|
|
67
|
+
"./prettier": "./dist/prettier.js",
|
|
68
|
+
"./tsconfig.build.json": "./public/tsconfig.build.json",
|
|
69
|
+
"./tsconfig.check.json": "./public/tsconfig.check.json"
|
|
70
|
+
},
|
|
71
|
+
"sideEffects": false
|
|
72
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.check.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
// project:
|
|
5
|
+
"rootDir": "${configDir}/src", // build only src folder
|
|
6
|
+
|
|
7
|
+
// emit:
|
|
8
|
+
"noEmit": false,
|
|
9
|
+
"outDir": "${configDir}/dist",
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"inlineSources": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["${configDir}/src"], // build only src folder
|
|
15
|
+
"exclude": ["**/node_modules", "${configDir}/dist", "**/*.{test,spec}.*"] // exclude from build dependencies, tests and compilation result
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// project:
|
|
4
|
+
"rootDir": "${configDir}", // check all files in directory where your tsconfig placed
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
"module": "nodenext", // for ability to run compiled code directly in Node.js (without bundlers)
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"],
|
|
9
|
+
"jsx": "react-jsx", // targets to modern React with automatic JSX runtime
|
|
10
|
+
|
|
11
|
+
// emit:
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"outDir": "${configDir}/dist", // compiled files will be in dist folder
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"inlineSources": true,
|
|
17
|
+
"rewriteRelativeImportExtensions": true, // compiled code will have correct paths (`import './a.ts'` >> `import './a.js'`)
|
|
18
|
+
|
|
19
|
+
// code style:
|
|
20
|
+
"noImplicitOverride": true,
|
|
21
|
+
"noUnusedLocals": true,
|
|
22
|
+
"forceConsistentCasingInFileNames": true,
|
|
23
|
+
|
|
24
|
+
// recommended:
|
|
25
|
+
"strict": true,
|
|
26
|
+
"moduleDetection": "force",
|
|
27
|
+
"esModuleInterop": true,
|
|
28
|
+
"skipLibCheck": true,
|
|
29
|
+
"isolatedModules": true,
|
|
30
|
+
"noUncheckedSideEffectImports": true, // ban import some side effect without type declaration
|
|
31
|
+
"noUncheckedIndexedAccess": true,
|
|
32
|
+
"allowImportingTsExtensions": true, // for ability to have correct import paths
|
|
33
|
+
"verbatimModuleSyntax": true, // requires to import types with `type` keyword
|
|
34
|
+
"erasableSyntaxOnly": true, // no enums, namespaces, parameter properties, etc.
|
|
35
|
+
"isolatedDeclarations": true // make code comply with the "no-slow-types" rule from JSR
|
|
36
|
+
},
|
|
37
|
+
"exclude": ["**/node_modules", "${configDir}/dist"]
|
|
38
|
+
}
|