@cherepanov.pavel/shareable-config 1.0.0
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/.editorconfig +11 -0
- package/.editorconfig-get.js +19 -0
- package/.get-all.js +29 -0
- package/.gitattributes +1 -0
- package/.gitattributes-get.js +19 -0
- package/.gitignore +15 -0
- package/.gitignore-get.js +47 -0
- package/.vscode/.code-snippets-get.js +49 -0
- package/.vscode/all-files.code-snippets +18 -0
- package/.vscode/extensions.json +25 -0
- package/.vscode/extensions.json-get.js +43 -0
- package/.vscode/settings.json +42 -0
- package/.vscode/settings.json-get.js +43 -0
- package/.vscode/vue.code-snippets +28 -0
- package/README.md +10 -0
- package/env.json5.set.js +14 -0
- package/jsconfig.json +9 -0
- package/package.json +54 -0
- package/tools/eslint-config/configs/global.js +26 -0
- package/tools/eslint-config/configs/javascript.js +21 -0
- package/tools/eslint-config/configs/typescript.js +28 -0
- package/tools/eslint-config/configs/vue.js +43 -0
- package/tools/eslint-config/index.js +4 -0
- package/tools/eslint-config/rules/constants.js +15 -0
- package/tools/eslint-config/rules/javascript/index.js +7 -0
- package/tools/eslint-config/rules/javascript/possible-problems.js +62 -0
- package/tools/eslint-config/rules/javascript/suggestions.js +254 -0
- package/tools/eslint-config/rules/severity.js +3 -0
- package/tools/eslint-config/rules/stylistic/index.js +2 -0
- package/tools/eslint-config/rules/stylistic/jsFormatting.js +172 -0
- package/tools/eslint-config/rules/stylistic/tsFormatting.js +9 -0
- package/tools/eslint-config/rules/typescript/common.js +130 -0
- package/tools/eslint-config/rules/typescript/compatibility.js +24 -0
- package/tools/eslint-config/rules/typescript/extension.js +52 -0
- package/tools/eslint-config/rules/typescript/index.js +9 -0
- package/tools/eslint-config/rules/vue/base.js +6 -0
- package/tools/eslint-config/rules/vue/extension.js +58 -0
- package/tools/eslint-config/rules/vue/formatting.js +41 -0
- package/tools/eslint-config/rules/vue/index.js +13 -0
- package/tools/eslint-config/rules/vue/possibleProblems.js +113 -0
- package/tools/eslint-config/rules/vue/suggestions.js +83 -0
- package/tools/stylelint-config/config.js +29 -0
- package/tools/stylelint-config/rules/base.js +26 -0
- package/tools/stylelint-config/rules/conflicts.js +7 -0
- package/tools/stylelint-config/rules/order.js +42 -0
- package/tools/stylelint-config/rules/property-groups.js +404 -0
- package/tools/stylelint-config/rules/scss.js +8 -0
- package/tools/stylelint-config/rules/stylistic.js +124 -0
- package/utils/communication.js +33 -0
- package/utils/copy-with-override.js +43 -0
- package/utils/env.js +16 -0
- package/utils/file-header.js +16 -0
- package/utils/file.js +64 -0
- package/utils/merge.js +180 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { copyWithOverride } from './utils/copy-with-override.js';
|
|
6
|
+
import { readFile } from 'fs/promises';
|
|
7
|
+
|
|
8
|
+
const fileName = '.editorconfig';
|
|
9
|
+
const destFile = path.join(process.cwd(), fileName);
|
|
10
|
+
|
|
11
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const src = path.join(dirname, fileName);
|
|
13
|
+
const srcFileData = await readFile(src, 'utf8');
|
|
14
|
+
|
|
15
|
+
copyWithOverride({
|
|
16
|
+
destFile,
|
|
17
|
+
srcFileData,
|
|
18
|
+
fileLabel: fileName,
|
|
19
|
+
});
|
package/.get-all.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from 'child_process';
|
|
4
|
+
import { readFile } from 'fs/promises';
|
|
5
|
+
|
|
6
|
+
const commands = [
|
|
7
|
+
'get-editorconfig',
|
|
8
|
+
'get-gitattributes',
|
|
9
|
+
'get-gitignore',
|
|
10
|
+
'get-extensions',
|
|
11
|
+
'get-settings',
|
|
12
|
+
'get-code-snippets',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
let hasError = false;
|
|
16
|
+
|
|
17
|
+
const pkg = JSON.parse(await readFile(new URL('./package.json', import.meta.url), 'utf8'));
|
|
18
|
+
|
|
19
|
+
commands.forEach((cmd) => {
|
|
20
|
+
const result = spawnSync('npx', ['-p', pkg.name, cmd], { stdio: 'inherit' });
|
|
21
|
+
if (result.status !== 0) {
|
|
22
|
+
console.error(`\nОшибка при выполнении команды: ${cmd}`);
|
|
23
|
+
hasError = true;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (hasError) {
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
package/.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto eol=lf
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { copyWithOverride } from './utils/copy-with-override.js';
|
|
6
|
+
import { readFile } from 'fs/promises';
|
|
7
|
+
|
|
8
|
+
const fileName = '.gitattributes';
|
|
9
|
+
const destFile = path.join(process.cwd(), fileName);
|
|
10
|
+
|
|
11
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const src = path.join(dirname, fileName);
|
|
13
|
+
const srcFileData = await readFile(src, 'utf8');
|
|
14
|
+
|
|
15
|
+
copyWithOverride({
|
|
16
|
+
destFile,
|
|
17
|
+
srcFileData,
|
|
18
|
+
fileLabel: fileName,
|
|
19
|
+
});
|
package/.gitignore
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { readFile } from 'fs/promises';
|
|
6
|
+
import { copyWithOverride } from './utils/copy-with-override.js';
|
|
7
|
+
import { getEnvs } from './utils/env.js';
|
|
8
|
+
|
|
9
|
+
const fileName = '.gitignore';
|
|
10
|
+
const destFile = path.join(process.cwd(), fileName);
|
|
11
|
+
|
|
12
|
+
async function getGitignoreFileData(framework) {
|
|
13
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const src = path.join(dirname, '.npmignore');
|
|
15
|
+
const srcFileData = await readFile(src, 'utf8');
|
|
16
|
+
|
|
17
|
+
const [commonData] = srcFileData.split(/^#\s*\w+/mu);
|
|
18
|
+
|
|
19
|
+
if (!framework) {
|
|
20
|
+
return commonData.trim();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const sections = srcFileData.split(/^#\s*/mu).slice(1);
|
|
24
|
+
const matchedSection = sections.find((section) => {
|
|
25
|
+
const [header] = section.split('\n');
|
|
26
|
+
return header.trim().toLowerCase() === framework;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (matchedSection) {
|
|
30
|
+
const [header, ...body] = matchedSection.split('\n');
|
|
31
|
+
return `${commonData.trim()}\n\n# ${header}\n${body.join('\n').trim()}`.trim();
|
|
32
|
+
}
|
|
33
|
+
// Если не найдено — только общий контент
|
|
34
|
+
return commonData.trim();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const { repositoryFramework } = await getEnvs();
|
|
39
|
+
const srcFileData = await getGitignoreFileData(repositoryFramework);
|
|
40
|
+
await copyWithOverride({
|
|
41
|
+
destFile,
|
|
42
|
+
srcFileData,
|
|
43
|
+
fileLabel: fileName,
|
|
44
|
+
});
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error('Ошибка:', err.message);
|
|
47
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { readFile } from 'fs/promises';
|
|
5
|
+
import { outputFile } from 'fs-extra';
|
|
6
|
+
import { mergeWithOverride } from '../utils/merge.js';
|
|
7
|
+
import { getHeader } from '../utils/file-header.js';
|
|
8
|
+
import { getSrcJSONFileData } from '../utils/file.js';
|
|
9
|
+
import { getEnvs } from '../utils/env.js';
|
|
10
|
+
|
|
11
|
+
const fileNames = ['vue.code-snippets', 'all-files.code-snippets'];
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const {
|
|
15
|
+
isRepositoryUseTypescript: isTs,
|
|
16
|
+
} = await getEnvs();
|
|
17
|
+
|
|
18
|
+
fileNames.forEach(async (fileName) => {
|
|
19
|
+
const srcFileData = await getSrcJSONFileData({
|
|
20
|
+
fileName,
|
|
21
|
+
isTs,
|
|
22
|
+
removeDuplicateKeys: fileName === 'vue.code-snippets',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
|
|
26
|
+
let destFileData;
|
|
27
|
+
let isDestFileHaveOverride;
|
|
28
|
+
try {
|
|
29
|
+
destFileData = await readFile(destFile, 'utf8');
|
|
30
|
+
isDestFileHaveOverride = destFileData.includes('// override');
|
|
31
|
+
} catch (err) {}
|
|
32
|
+
|
|
33
|
+
let result;
|
|
34
|
+
if (isDestFileHaveOverride) {
|
|
35
|
+
result = await mergeWithOverride(srcFileData, destFileData);
|
|
36
|
+
} else {
|
|
37
|
+
result = srcFileData;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
await outputFile(destFile, `${getHeader()}${result}`);
|
|
41
|
+
if (isDestFileHaveOverride) {
|
|
42
|
+
console.info(`${fileName} обновлён с учётом override`);
|
|
43
|
+
} else {
|
|
44
|
+
console.info(`${fileName} пересоздан`);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
} catch (err) {
|
|
48
|
+
console.error('Ошибка:', err.message);
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
// TODO: delimit the scope in another way
|
|
3
|
+
"template for todo comments for easy search in project for HTML only": {
|
|
4
|
+
"scope": "html",
|
|
5
|
+
"prefix": "t html todo",
|
|
6
|
+
"body": [
|
|
7
|
+
"$BLOCK_COMMENT_START TODO:",
|
|
8
|
+
"$0"
|
|
9
|
+
"$BLOCK_COMMENT_END"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"template for todo comments for easy search in project": {
|
|
13
|
+
"prefix": "t todo",
|
|
14
|
+
"body": [
|
|
15
|
+
"$LINE_COMMENT TODO: ",
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"recommendations": [
|
|
3
|
+
// "eamodio.gitlens",
|
|
4
|
+
|
|
5
|
+
// typescript
|
|
6
|
+
"johnsoncodehk.vscode-tsconfig-helper",
|
|
7
|
+
// typescript
|
|
8
|
+
"yoavbls.pretty-ts-errors",
|
|
9
|
+
"vue.volar",
|
|
10
|
+
"mrmlnc.vscode-scss",
|
|
11
|
+
"ms-azuretools.vscode-containers",
|
|
12
|
+
// "redhat.vscode-yaml",
|
|
13
|
+
"savh.json5-kit",
|
|
14
|
+
|
|
15
|
+
"editorconfig.editorconfig",
|
|
16
|
+
"dbaeumer.vscode-eslint",
|
|
17
|
+
"stylelint.vscode-stylelint",
|
|
18
|
+
|
|
19
|
+
"streetsidesoftware.code-spell-checker",
|
|
20
|
+
"streetsidesoftware.code-spell-checker-russian"
|
|
21
|
+
|
|
22
|
+
// need to check that it's working well
|
|
23
|
+
// iulian-radu-at.find-unused-exports
|
|
24
|
+
],
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { readFile } from 'fs/promises';
|
|
5
|
+
import { getSrcJSONFileData } from '../utils/file.js';
|
|
6
|
+
import { mergeWithOverride } from '../utils/merge.js';
|
|
7
|
+
import { getHeader } from '../utils/file-header.js';
|
|
8
|
+
import { getEnvs } from '../utils/env.js';
|
|
9
|
+
import { outputFile } from 'fs-extra';
|
|
10
|
+
|
|
11
|
+
const fileName = 'extensions.json';
|
|
12
|
+
const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const {
|
|
16
|
+
isRepositoryUseTypescript: isTs,
|
|
17
|
+
} = await getEnvs();
|
|
18
|
+
const baseContent = await getSrcJSONFileData({
|
|
19
|
+
fileName,
|
|
20
|
+
isTs,
|
|
21
|
+
});
|
|
22
|
+
let overrideContent;
|
|
23
|
+
try {
|
|
24
|
+
const fileData = await readFile(destFile, 'utf8');
|
|
25
|
+
overrideContent = fileData.includes('// override') ? fileData : undefined;
|
|
26
|
+
} catch (err) {}
|
|
27
|
+
|
|
28
|
+
let result;
|
|
29
|
+
if (overrideContent) {
|
|
30
|
+
result = await mergeWithOverride(baseContent, overrideContent);
|
|
31
|
+
} else {
|
|
32
|
+
result = baseContent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
await outputFile(destFile, `${getHeader()}${result}`);
|
|
36
|
+
if (overrideContent) {
|
|
37
|
+
console.info(`${fileName} обновлён с учётом override`);
|
|
38
|
+
} else {
|
|
39
|
+
console.info(`${fileName} пересоздан`);
|
|
40
|
+
}
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error('Ошибка:', err.message);
|
|
43
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"editor.linkedEditing": true,
|
|
3
|
+
"editor.suggestSelection": "recentlyUsed",
|
|
4
|
+
"git.blame.editorDecoration.enabled": true,
|
|
5
|
+
|
|
6
|
+
"explorer.fileNesting.enabled": true,
|
|
7
|
+
"explorer.fileNesting.patterns": {
|
|
8
|
+
"frontend-configs.env.json5": "eslint.config.*s, stylelint.config.*s, .editorconfig",
|
|
9
|
+
".env.*.local": ".env.*",
|
|
10
|
+
".gitignore": ".gitattributes, lefthook.yml",
|
|
11
|
+
// ".gitlab-ci.yml": "Dockerfile, .releaserc.template.yaml",
|
|
12
|
+
"package.json": ".npmrc, package-lock.json",
|
|
13
|
+
"README.md": "*.md",
|
|
14
|
+
// typescript
|
|
15
|
+
"tsconfig.json": "tsconfig.*.json, *.d.ts"
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
"javascript.preferences.importModuleSpecifier": "non-relative",
|
|
19
|
+
// typescript
|
|
20
|
+
"typescript.preferences.importModuleSpecifier": "non-relative",
|
|
21
|
+
// typescript
|
|
22
|
+
"typescript.tsdk": "./node_modules/typescript/lib",
|
|
23
|
+
// typescript
|
|
24
|
+
"typescript.enablePromptUseWorkspaceTsdk": true,
|
|
25
|
+
|
|
26
|
+
"json.validate.enable": false,
|
|
27
|
+
"editor.formatOnSave": false,
|
|
28
|
+
"editor.codeActionsOnSave": {
|
|
29
|
+
"source.fixAll.eslint": "explicit",
|
|
30
|
+
"source.fixAll.stylelint": "explicit",
|
|
31
|
+
},
|
|
32
|
+
// "stylelint.validate": [
|
|
33
|
+
// "css",
|
|
34
|
+
// "scss",
|
|
35
|
+
// "vue"
|
|
36
|
+
// ],
|
|
37
|
+
|
|
38
|
+
"cSpell.words": [
|
|
39
|
+
"Cherepanov",
|
|
40
|
+
"Pavel"
|
|
41
|
+
],
|
|
42
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { readFile } from 'fs/promises';
|
|
5
|
+
import { getSrcJSONFileData } from '../utils/file.js';
|
|
6
|
+
import { mergeWithOverride } from '../utils/merge.js';
|
|
7
|
+
import { getHeader } from '../utils/file-header.js';
|
|
8
|
+
import { getEnvs } from '../utils/env.js';
|
|
9
|
+
import { outputFile } from 'fs-extra';
|
|
10
|
+
|
|
11
|
+
const fileName = 'settings.json';
|
|
12
|
+
const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const {
|
|
16
|
+
isRepositoryUseTypescript: isTs,
|
|
17
|
+
} = await getEnvs();
|
|
18
|
+
const baseContent = await getSrcJSONFileData({
|
|
19
|
+
fileName,
|
|
20
|
+
isTs,
|
|
21
|
+
});
|
|
22
|
+
let overrideContent;
|
|
23
|
+
try {
|
|
24
|
+
const fileData = await readFile(destFile, 'utf8');
|
|
25
|
+
overrideContent = fileData.includes('// override') ? fileData : undefined;
|
|
26
|
+
} catch (err) {}
|
|
27
|
+
|
|
28
|
+
let result;
|
|
29
|
+
if (overrideContent) {
|
|
30
|
+
result = await mergeWithOverride(baseContent, overrideContent);
|
|
31
|
+
} else {
|
|
32
|
+
result = baseContent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
await outputFile(destFile, `${getHeader()}${result}`);
|
|
36
|
+
if (overrideContent) {
|
|
37
|
+
console.info(`${fileName} обновлён с учётом override`);
|
|
38
|
+
} else {
|
|
39
|
+
console.info(`${fileName} пересоздан`);
|
|
40
|
+
}
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error('Ошибка:', err.message);
|
|
43
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template for empty vue file": {
|
|
3
|
+
"scope": "vue",
|
|
4
|
+
"prefix": "t vue file",
|
|
5
|
+
"body": [
|
|
6
|
+
"<script setup>",
|
|
7
|
+
"</script>",
|
|
8
|
+
"",
|
|
9
|
+
"<template>",
|
|
10
|
+
"</template>",
|
|
11
|
+
"",
|
|
12
|
+
"<style scoped lang=\"scss\">",
|
|
13
|
+
"</style>"
|
|
14
|
+
],
|
|
15
|
+
// typescript multiline
|
|
16
|
+
"body": [
|
|
17
|
+
"<script setup lang=\"ts\">",
|
|
18
|
+
"</script>",
|
|
19
|
+
"",
|
|
20
|
+
"<template>",
|
|
21
|
+
"</template>",
|
|
22
|
+
"",
|
|
23
|
+
"<style scoped lang=\"scss\">",
|
|
24
|
+
"</style>"
|
|
25
|
+
],
|
|
26
|
+
// typescript multiline end
|
|
27
|
+
},
|
|
28
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# New repositories setup
|
|
2
|
+
The goal of this project is to provide easy creation of new repositories with code linting settings(and not only) that I like.
|
|
3
|
+
I will be glad if it is useful to someone else.
|
|
4
|
+
|
|
5
|
+
## OS that have been tested and in which correct operation with this setup is guaranteed
|
|
6
|
+
### Windows
|
|
7
|
+
|
|
8
|
+
## IDEs that have been tested and in which correct operation with this setup is guaranteed
|
|
9
|
+
### Visual studio code(version 1.86.0+)
|
|
10
|
+
You need to install extensions from .vscode/extensions.json
|
package/env.json5.set.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { askFramework, askTypescript } from './utils/communication.js';
|
|
4
|
+
import { getEnvs, setEnvs } from './utils/env.js';
|
|
5
|
+
|
|
6
|
+
let envs = {};
|
|
7
|
+
try {
|
|
8
|
+
envs = await getEnvs();
|
|
9
|
+
} catch (err) {}
|
|
10
|
+
|
|
11
|
+
envs.isRepositoryUseTypescript = await askTypescript();
|
|
12
|
+
envs.repositoryFramework = await askFramework();
|
|
13
|
+
|
|
14
|
+
await setEnvs(envs);
|
package/jsconfig.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cherepanov.pavel/shareable-config",
|
|
3
|
+
"description": "setup for new repositories",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"packageManager": "npm@10.9.2",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/Cherepanov-Pavel/shareable-config"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"env.json5",
|
|
13
|
+
"env.json5.set.js",
|
|
14
|
+
".editorconfig",
|
|
15
|
+
".editorconfig-get.js",
|
|
16
|
+
".gitattributes",
|
|
17
|
+
".gitattributes-get.js",
|
|
18
|
+
".gitignore",
|
|
19
|
+
".gitignore-get.js",
|
|
20
|
+
".vscode/",
|
|
21
|
+
"tools/",
|
|
22
|
+
"utils/",
|
|
23
|
+
"jsconfig.json"
|
|
24
|
+
],
|
|
25
|
+
"bin": {
|
|
26
|
+
"set-env": "./env.json5.set.js",
|
|
27
|
+
"get-all": "./.get-all.js",
|
|
28
|
+
"get-editorconfig": "./.editorconfig-get.js",
|
|
29
|
+
"get-gitattributes": "./.gitattributes-get.js",
|
|
30
|
+
"get-gitignore": "./.gitignore-get.js",
|
|
31
|
+
"get-extensions": "./.vscode/extensions.json-get.js",
|
|
32
|
+
"get-settings": "./.vscode/settings.json-get.js",
|
|
33
|
+
"get-code-snippets": "./.vscode/.code-snippets-get.js"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@eslint/compat": "^2.0.5",
|
|
37
|
+
"@stylistic/eslint-plugin": "^5.1.0",
|
|
38
|
+
"@stylistic/stylelint-plugin": "^3.1.3",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
40
|
+
"@typescript-eslint/parser": "^8.57.0",
|
|
41
|
+
"eslint": "^10.0.3",
|
|
42
|
+
"eslint-plugin-vue": "^10.8.0",
|
|
43
|
+
"fs-extra": "^11.3.0",
|
|
44
|
+
"jiti": "^2.4.2",
|
|
45
|
+
"json5": "^2.2.3",
|
|
46
|
+
"postcss-html": "^1.8.0",
|
|
47
|
+
"stylelint": "^16.21.0",
|
|
48
|
+
"stylelint-config-standard": "^38.0.0",
|
|
49
|
+
"stylelint-config-standard-scss": "^15.0.1",
|
|
50
|
+
"stylelint-config-standard-vue": "^1.0.0",
|
|
51
|
+
"stylelint-order": "^7.0.0",
|
|
52
|
+
"vue-eslint-parser": "^10.4.0"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import { includeIgnoreFile } from '@eslint/compat';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
|
|
6
|
+
const gitignorePath = path.join(process.cwd(), '.gitignore');
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
includeIgnoreFile(gitignorePath),
|
|
10
|
+
{
|
|
11
|
+
name: 'Additional .gitignore patterns',
|
|
12
|
+
ignores: [
|
|
13
|
+
'public/js/*',
|
|
14
|
+
'**/*.code-snippets'
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
files: ['**/*.*js', '**/*.*vue'],
|
|
19
|
+
languageOptions: {
|
|
20
|
+
globals: {
|
|
21
|
+
...globals.browser,
|
|
22
|
+
...globals.node,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
2
|
+
|
|
3
|
+
import { jsRules } from '../rules/javascript/index.js';
|
|
4
|
+
import { jsFormatting } from '../rules/stylistic/index.js';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
files: ['**/*.*js'],
|
|
8
|
+
plugins: {
|
|
9
|
+
'@stylistic': stylisticPlugin,
|
|
10
|
+
},
|
|
11
|
+
languageOptions: {
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
parserOptions: {
|
|
14
|
+
sourceType: 'module',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
rules: {
|
|
18
|
+
...jsRules,
|
|
19
|
+
...jsFormatting,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
2
|
+
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
3
|
+
|
|
4
|
+
import { tsRules } from '../rules/typescript/index.js';
|
|
5
|
+
import { jsFormatting, tsFormatting } from '../rules/stylistic/index.js';
|
|
6
|
+
|
|
7
|
+
import tsParser from '@typescript-eslint/parser';
|
|
8
|
+
import { jsRules } from '../rules/javascript/index.js';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
files: ['**/*.*ts'],
|
|
12
|
+
plugins: {
|
|
13
|
+
'@typescript-eslint': tsPlugin,
|
|
14
|
+
'@stylistic': stylisticPlugin,
|
|
15
|
+
},
|
|
16
|
+
languageOptions: {
|
|
17
|
+
parser: tsParser,
|
|
18
|
+
parserOptions: {
|
|
19
|
+
projectService: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
...jsRules,
|
|
24
|
+
...jsFormatting,
|
|
25
|
+
...tsRules,
|
|
26
|
+
...tsFormatting,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { vueRules } from '../rules/vue/index.js';
|
|
2
|
+
import { jsRules } from '../rules/javascript/index.js';
|
|
3
|
+
import { tsRules } from '../rules/typescript/index.js';
|
|
4
|
+
|
|
5
|
+
import { jsFormatting, tsFormatting } from '../rules/stylistic/index.js';
|
|
6
|
+
|
|
7
|
+
import vuePlugin from 'eslint-plugin-vue';
|
|
8
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
9
|
+
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
10
|
+
|
|
11
|
+
import vueParser from 'vue-eslint-parser';
|
|
12
|
+
import tsParser from '@typescript-eslint/parser';
|
|
13
|
+
import { getEnvs } from '../../../utils/env.js';
|
|
14
|
+
|
|
15
|
+
// https://github.com/sveltejs/eslint-plugin-svelte/issues/152#issuecomment-1150803175
|
|
16
|
+
const {
|
|
17
|
+
isRepositoryUseTypescript: isTs,
|
|
18
|
+
} = await getEnvs();
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
files: ['**/*.vue'],
|
|
22
|
+
plugins: {
|
|
23
|
+
'vue': vuePlugin,
|
|
24
|
+
'@stylistic': stylisticPlugin,
|
|
25
|
+
|
|
26
|
+
...(isTs ? { '@typescript-eslint': tsPlugin } : {}),
|
|
27
|
+
},
|
|
28
|
+
languageOptions: {
|
|
29
|
+
parser: vueParser,
|
|
30
|
+
parserOptions: {
|
|
31
|
+
parser: isTs ? tsParser : 'espree',
|
|
32
|
+
...(isTs ? { projectService: true } : {}),
|
|
33
|
+
extraFileExtensions: ['.vue'],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
rules: {
|
|
37
|
+
...jsRules,
|
|
38
|
+
...jsFormatting,
|
|
39
|
+
...(isTs ? tsRules : {}),
|
|
40
|
+
...(isTs ? tsFormatting : {}),
|
|
41
|
+
...vueRules,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const INDENT_SIZE = 2;
|
|
2
|
+
export const STR_LENGTH = 100;
|
|
3
|
+
|
|
4
|
+
export const MAX_LEN = {
|
|
5
|
+
code: STR_LENGTH,
|
|
6
|
+
tabWidth: INDENT_SIZE,
|
|
7
|
+
|
|
8
|
+
ignoreComments: false,
|
|
9
|
+
ignoreTrailingComments: false,
|
|
10
|
+
|
|
11
|
+
ignoreUrls: true,
|
|
12
|
+
ignoreStrings: true,
|
|
13
|
+
ignoreTemplateLiterals: true,
|
|
14
|
+
ignoreRegExpLiterals: true,
|
|
15
|
+
};
|