Skip to content

Commit 8e2b4fe

Browse files
committed
📦 Chore(custom): update eslint && readme
1 parent f174f8c commit 8e2b4fe

9 files changed

Lines changed: 154 additions & 44 deletions

File tree

.eslintignore

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

.eslintrc.js

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

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm lint

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ src/
88
.travis.yml
99
.serena/
1010
.pnpm-store/
11+
.husky/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ A tool for picture uploading. Both CLI & api supports. It also supports plugin s
2929

3030
## Installation
3131

32-
PicGo should be installed with node.js >= 12 (v1.5.0-alpha.4 and small) & node.js >= 16 (since v1.5.0-alpha.5).
32+
PicGo should be installed with node.js >= 16 (v1.5.0-alpha.5 and small) & node.js >= 20 (since v1.6.0).
3333

3434
### Global install
3535

eslint.config.js

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
const globals = require('globals')
2+
const js = require('@eslint/js')
3+
const tsPlugin = require('@typescript-eslint/eslint-plugin')
4+
const tsParser = require('@typescript-eslint/parser')
5+
const importPlugin = require('eslint-plugin-import')
6+
const promisePlugin = require('eslint-plugin-promise')
7+
const eslintConfigPrettier = require('eslint-config-prettier')
8+
9+
const tsEslintRecommendedAdjustments =
10+
tsPlugin.configs['eslint-recommended'].overrides?.[0]?.rules ?? {}
11+
12+
module.exports = [
13+
{
14+
ignores: [
15+
'**/dist/**',
16+
'**/node_modules/**',
17+
'**/*.d.ts',
18+
'.eslintrc.js',
19+
'bin',
20+
'scripts/**/*.js'
21+
],
22+
linterOptions: {
23+
reportUnusedDisableDirectives: 'off'
24+
}
25+
},
26+
{
27+
...js.configs.recommended,
28+
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
29+
ignores: ['**/dist/**', '**/node_modules/**'],
30+
languageOptions: {
31+
sourceType: 'commonjs',
32+
globals: {
33+
...globals.node,
34+
...globals.es2022
35+
}
36+
},
37+
rules: {
38+
'no-undef': 'off',
39+
semi: ['error', 'never']
40+
}
41+
},
42+
{
43+
files: ['**/*.d.ts'],
44+
ignores: ['**/dist/**', '**/node_modules/**'],
45+
languageOptions: {
46+
parser: tsParser,
47+
parserOptions: {
48+
project: './tsconfig.json',
49+
tsconfigRootDir: __dirname,
50+
sourceType: 'module'
51+
},
52+
globals: {
53+
...globals.node,
54+
...globals.es2022
55+
}
56+
},
57+
plugins: {
58+
'@typescript-eslint': tsPlugin
59+
},
60+
rules: {
61+
'no-var': 'off',
62+
'@typescript-eslint/naming-convention': 'off'
63+
}
64+
},
65+
{
66+
files: ['src/**/*.ts', 'scripts/**/*.ts', 'types/**/*.ts'],
67+
ignores: ['**/*.d.ts'],
68+
languageOptions: {
69+
parser: tsParser,
70+
parserOptions: {
71+
project: './tsconfig.json',
72+
tsconfigRootDir: __dirname,
73+
sourceType: 'module'
74+
},
75+
globals: {
76+
...globals.node,
77+
...globals.es2022
78+
}
79+
},
80+
plugins: {
81+
'@typescript-eslint': tsPlugin,
82+
import: importPlugin,
83+
promise: promisePlugin
84+
},
85+
rules: {
86+
...tsEslintRecommendedAdjustments,
87+
...tsPlugin.configs.recommended.rules,
88+
...tsPlugin.configs['recommended-requiring-type-checking'].rules,
89+
...promisePlugin.configs.recommended.rules,
90+
...eslintConfigPrettier.rules,
91+
'@typescript-eslint/strict-boolean-expressions': 'off',
92+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
93+
'@typescript-eslint/return-await': 'off',
94+
'@typescript-eslint/no-floating-promises': 'off',
95+
'@typescript-eslint/no-non-null-assertion': 'off',
96+
'@typescript-eslint/no-explicit-any': 'off',
97+
'@typescript-eslint/no-unsafe-member-access': 'off',
98+
'@typescript-eslint/no-unsafe-assignment': 'off',
99+
'@typescript-eslint/no-unsafe-argument': 'off',
100+
'@typescript-eslint/no-unsafe-call': 'off',
101+
'@typescript-eslint/no-unsafe-return': 'off',
102+
'@typescript-eslint/no-unsafe-function-type': 'off',
103+
'@typescript-eslint/no-redundant-type-constituents': 'off',
104+
'@typescript-eslint/ban-ts-comment': 'off',
105+
'@typescript-eslint/require-await': 'off',
106+
'@typescript-eslint/no-require-imports': 'off',
107+
'@typescript-eslint/no-unused-vars': 'off',
108+
'@typescript-eslint/prefer-promise-reject-errors': 'off',
109+
'@typescript-eslint/naming-convention': [
110+
'error',
111+
{
112+
selector: 'interface',
113+
format: ['PascalCase'],
114+
custom: { regex: '^I[A-Z]', match: true }
115+
}
116+
],
117+
'import/no-unresolved': 'off',
118+
'import/namespace': 'off',
119+
'import/no-duplicates': 'off',
120+
'import/default': 'off',
121+
'import/no-named-as-default': 'off',
122+
'import/no-named-as-default-member': 'off',
123+
'promise/always-return': 'off',
124+
'promise/no-promise-in-callback': 'off',
125+
semi: ['error', 'never']
126+
},
127+
settings: {
128+
'import/resolver': {
129+
typescript: true,
130+
node: true
131+
}
132+
}
133+
}
134+
]

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
},
1414
"scripts": {
1515
"start": "node ./bin/picgo",
16-
"lint": "eslint . --ext .ts",
16+
"lint": "eslint src --ext .ts",
1717
"test": "echo \"Error: no test specified\" && exit 1",
1818
"build": "cross-env NODE_ENV=production rimraf ./dist && rollup -c rollup.config.js",
1919
"dev": "cross-env NODE_ENV=development rollup -c rollup.config.js -w",
2020
"patch": "npm version patch && git push origin master && git push origin --tags",
2121
"minor": "npm version minor && git push origin master && git push origin --tags",
2222
"major": "npm version major && git push origin master && git push origin --tags",
2323
"cz": "git-cz",
24-
"release": "bump-version"
24+
"release": "bump-version",
25+
"prepare": "husky"
2526
},
2627
"keywords": [
2728
"picture",
@@ -50,6 +51,7 @@
5051
"author": "Molunerfinn",
5152
"license": "MIT",
5253
"devDependencies": {
54+
"@eslint/js": "^9.39.1",
5355
"@picgo/bump-version": "^2.0.0",
5456
"@rollup/plugin-commonjs": "^29.0.0",
5557
"@rollup/plugin-json": "^6.1.0",
@@ -84,6 +86,7 @@
8486
"eslint-plugin-import": "^2.32.0",
8587
"eslint-plugin-promise": "^7.2.1",
8688
"execa": "^5.1.1",
89+
"globals": "^16.5.0",
8790
"husky": "^9.1.7",
8891
"pre-commit": "^1.2.2",
8992
"rollup": "^4.53.3",

pnpm-lock.yaml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/custom-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/naming-convention */
21
declare module '*.sh' {
32
const src: string
43
export default src

0 commit comments

Comments
 (0)