mirror of
https://github.com/hexboy/maven-mirror-tool.git
synced 2025-04-09 00:09:09 +00:00
add eslint and prettier
This commit is contained in:
parent
419a16c7cf
commit
8ae75129e0
10 changed files with 971 additions and 16 deletions
21
.editorconfig
Normal file
21
.editorconfig
Normal file
|
@ -0,0 +1,21 @@
|
|||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# Matches multiple files with brace expansion notation
|
||||
# Set default charset
|
||||
[*.{mjs,ts}]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# Matches the exact files either package.json or .travis.yml
|
||||
[package.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
1
.prettierignore
Normal file
1
.prettierignore
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules
|
6
.prettierrc
Normal file
6
.prettierrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"semi": true,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
}
|
|
@ -5,11 +5,11 @@ module.exports = {
|
|||
script: 'tsx src/index.ts --port=${PORT}',
|
||||
max_memory_restart: '300M',
|
||||
env_production: {
|
||||
NODE_ENV: "production"
|
||||
},
|
||||
env_development: {
|
||||
NODE_ENV: "development"
|
||||
}
|
||||
NODE_ENV: 'production',
|
||||
},
|
||||
env_development: {
|
||||
NODE_ENV: 'development',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
12
eslint.config.mjs
Normal file
12
eslint.config.mjs
Normal file
|
@ -0,0 +1,12 @@
|
|||
import globals from 'globals';
|
||||
import pluginJs from '@eslint/js';
|
||||
import tsEslint from 'typescript-eslint';
|
||||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
||||
|
||||
export default [
|
||||
{ files: ['**/*.{js,mjs,cjs,ts}'] },
|
||||
{ languageOptions: { globals: globals.node } },
|
||||
pluginJs.configs.recommended,
|
||||
...tsEslint.configs.recommended,
|
||||
eslintPluginPrettierRecommended,
|
||||
];
|
|
@ -28,11 +28,18 @@
|
|||
"typescript": "^5.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.9.0",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/got": "^9.6.12",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/morgan": "^1.9.9"
|
||||
"@types/morgan": "^1.9.9",
|
||||
"eslint": "^9.9.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"globals": "^15.9.0",
|
||||
"prettier": "^3.3.3",
|
||||
"typescript-eslint": "^8.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
|
|
|
@ -2,6 +2,7 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
import yaml from 'js-yaml';
|
||||
import minimist from 'minimist';
|
||||
import { IConfig } from '../types';
|
||||
|
||||
const config = yaml.load(
|
||||
fs.existsSync('config.local.yml')
|
||||
|
|
|
@ -15,7 +15,10 @@ export const getCachedServer = (filePath: string) => {
|
|||
return srv;
|
||||
};
|
||||
|
||||
export const printServedEndpoints = (port: number | string, urlPath: string) => {
|
||||
export const printServedEndpoints = (
|
||||
port: number | string,
|
||||
urlPath: string
|
||||
) => {
|
||||
try {
|
||||
const interfaces = os.networkInterfaces();
|
||||
const list = Object.keys(interfaces)
|
||||
|
@ -38,7 +41,9 @@ export const printServedEndpoints = (port: number | string, urlPath: string) =>
|
|||
);
|
||||
}
|
||||
console.log('--------------------------------------------');
|
||||
} catch (error) {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
} catch (e: unknown) {
|
||||
console.log('\n🚀 Serving!');
|
||||
console.log('--------------------------------------------');
|
||||
console.log(`Local: http://0.0.0.0:${port}/${urlPath}`);
|
||||
|
|
2
types.ts
2
types.ts
|
@ -19,7 +19,7 @@ type TServer = {
|
|||
};
|
||||
};
|
||||
|
||||
interface IConfig {
|
||||
export interface IConfig {
|
||||
PORT: number;
|
||||
CACHE_DIR: string;
|
||||
REPOSITORIES: TServer[];
|
||||
|
|
Loading…
Add table
Reference in a new issue