Add eslint-plugin-promise back (#4022)

This commit is contained in:
qwerty287 2024-08-17 08:09:48 +02:00 committed by GitHub
parent 405d089129
commit b357ae7243
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 57 additions and 164 deletions

View file

@ -4,6 +4,7 @@
import antfu from '@antfu/eslint-config';
import js from '@eslint/js';
import vueI18n from '@intlify/eslint-plugin-vue-i18n';
import eslintPromise from 'eslint-plugin-promise';
import eslintPluginVueScopedCSS from 'eslint-plugin-vue-scoped-css';
export default antfu(
@ -20,23 +21,52 @@ export default antfu(
},
js.configs.recommended,
// eslintPromise.configs.recommended,
// TypeScript
//...tseslint.configs.recommended,
//...tseslint.configs.recommendedTypeChecked,
//...tseslint.configs.strictTypeChecked,
//...tseslint.configs.stylisticTypeChecked,
eslintPromise.configs['flat/recommended'],
...eslintPluginVueScopedCSS.configs['flat/recommended'],
...vueI18n.configs['flat/recommended'],
{
rules: {
'import/order': 'off',
'sort-imports': 'off',
'promise/prefer-await-to-callbacks': 'error',
// Vue I18n
'@intlify/vue-i18n/no-raw-text': [
'error',
{
attributes: {
'/.+/': ['label'],
},
},
],
'@intlify/vue-i18n/key-format-style': ['error', 'snake_case'],
'@intlify/vue-i18n/no-duplicate-keys-in-locale': 'error',
'@intlify/vue-i18n/no-dynamic-keys': 'error',
'@intlify/vue-i18n/no-deprecated-i18n-component': 'error',
'@intlify/vue-i18n/no-deprecated-tc': 'error',
'@intlify/vue-i18n/no-i18n-t-path-prop': 'error',
'@intlify/vue-i18n/no-missing-keys-in-other-locales': 'off',
'@intlify/vue-i18n/valid-message-syntax': 'error',
'@intlify/vue-i18n/no-missing-keys': 'error',
'@intlify/vue-i18n/no-unknown-locale': 'error',
'@intlify/vue-i18n/no-unused-keys': ['error', { extensions: ['.ts', '.vue'] }],
'@intlify/vue-i18n/prefer-sfc-lang-attr': 'error',
'@intlify/vue-i18n/no-html-messages': 'error',
'@intlify/vue-i18n/prefer-linked-key-with-paren': 'error',
'@intlify/vue-i18n/sfc-locale-attr': 'error',
},
settings: {
// Vue I18n
'vue-i18n': {
localeDir: './src/assets/locales/en.json',
// Specify the version of `vue-i18n` you are using.
// If not specified, the message will be parsed twice.
messageSyntaxVersion: '^9.0.0',
},
},
},
...eslintPluginVueScopedCSS.configs['flat/recommended'],
// Vue
{
files: ['**/*.vue'],
@ -64,44 +94,6 @@ export default antfu(
},
},
// Vue I18n
...vueI18n.configs['flat/recommended'],
{
rules: {
'@intlify/vue-i18n/no-raw-text': [
'error',
{
attributes: {
'/.+/': ['label'],
},
},
],
'@intlify/vue-i18n/key-format-style': ['error', 'snake_case'],
'@intlify/vue-i18n/no-duplicate-keys-in-locale': 'error',
'@intlify/vue-i18n/no-dynamic-keys': 'error',
'@intlify/vue-i18n/no-deprecated-i18n-component': 'error',
'@intlify/vue-i18n/no-deprecated-tc': 'error',
'@intlify/vue-i18n/no-i18n-t-path-prop': 'error',
'@intlify/vue-i18n/no-missing-keys-in-other-locales': 'off',
'@intlify/vue-i18n/valid-message-syntax': 'error',
'@intlify/vue-i18n/no-missing-keys': 'error',
'@intlify/vue-i18n/no-unknown-locale': 'error',
'@intlify/vue-i18n/no-unused-keys': ['error', { extensions: ['.ts', '.vue'] }],
'@intlify/vue-i18n/prefer-sfc-lang-attr': 'error',
'@intlify/vue-i18n/no-html-messages': 'error',
'@intlify/vue-i18n/prefer-linked-key-with-paren': 'error',
'@intlify/vue-i18n/sfc-locale-attr': 'error',
},
settings: {
'vue-i18n': {
localeDir: './src/assets/locales/en.json',
// Specify the version of `vue-i18n` you are using.
// If not specified, the message will be parsed twice.
messageSyntaxVersion: '^9.0.0',
},
},
},
// Ignore list
{
ignores: [

View file

@ -51,14 +51,13 @@
"@vue/compiler-sfc": "^3.4.27",
"@vue/test-utils": "^2.4.6",
"eslint": "^9.4.0",
"eslint-plugin-promise": "^6.2.0",
"eslint-plugin-promise": "^7.0.0",
"eslint-plugin-vue-scoped-css": "^2.8.0",
"jsdom": "^24.1.0",
"prettier": "^3.3.0",
"replace-in-file": "^8.0.0",
"tinycolor2": "^1.6.0",
"typescript": "5.5.4",
"typescript-eslint": "^7.12.0",
"vite": "^5.2.12",
"vite-plugin-prismjs": "^0.0.11",
"vite-plugin-windicss": "^1.9.3",

View file

@ -106,8 +106,8 @@ importers:
specifier: ^9.4.0
version: 9.9.0(jiti@1.21.6)
eslint-plugin-promise:
specifier: ^6.2.0
version: 6.6.0(eslint@9.9.0(jiti@1.21.6))
specifier: ^7.0.0
version: 7.1.0(eslint@9.9.0(jiti@1.21.6))
eslint-plugin-vue-scoped-css:
specifier: ^2.8.0
version: 2.8.1(eslint@9.9.0(jiti@1.21.6))(vue-eslint-parser@9.4.3(eslint@9.9.0(jiti@1.21.6)))
@ -126,9 +126,6 @@ importers:
typescript:
specifier: 5.5.4
version: 5.5.4
typescript-eslint:
specifier: ^7.12.0
version: 7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
vite:
specifier: ^5.2.12
version: 5.4.1(@types/node@20.14.15)(stylus@0.57.0)
@ -756,17 +753,6 @@ packages:
'@types/web-bluetooth@0.0.20':
resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==}
'@typescript-eslint/eslint-plugin@7.18.0':
resolution: {integrity: sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
'@typescript-eslint/parser': ^7.0.0
eslint: ^8.56.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
'@typescript-eslint/eslint-plugin@8.1.0':
resolution: {integrity: sha512-LlNBaHFCEBPHyD4pZXb35mzjGkuGKXU5eeCA1SxvHfiRES0E82dOounfVpL4DCqYvJEKab0bZIA0gCRpdLKkCw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@ -778,16 +764,6 @@ packages:
typescript:
optional: true
'@typescript-eslint/parser@7.18.0':
resolution: {integrity: sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
'@typescript-eslint/parser@8.1.0':
resolution: {integrity: sha512-U7iTAtGgJk6DPX9wIWPPOlt1gO57097G06gIcl0N0EEnNw8RGD62c+2/DiP/zL7KrkqnnqF7gtFGR7YgzPllTA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@ -806,16 +782,6 @@ packages:
resolution: {integrity: sha512-DsuOZQji687sQUjm4N6c9xABJa7fjvfIdjqpSIIVOgaENf2jFXiM9hIBZOL3hb6DHK9Nvd2d7zZnoMLf9e0OtQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript-eslint/type-utils@7.18.0':
resolution: {integrity: sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
'@typescript-eslint/type-utils@8.1.0':
resolution: {integrity: sha512-oLYvTxljVvsMnldfl6jIKxTaU7ok7km0KDrwOt1RHYu6nxlhN3TIx8k5Q52L6wR33nOwDgM7VwW1fT1qMNfFIA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@ -1462,9 +1428,9 @@ packages:
vue-eslint-parser:
optional: true
eslint-plugin-promise@6.6.0:
resolution: {integrity: sha512-57Zzfw8G6+Gq7axm2Pdo3gW/Rx3h9Yywgn61uE/3elTCOePEHVrn2i5CdfBwA1BLK0Q0WqctICIUSqXZW/VprQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
eslint-plugin-promise@7.1.0:
resolution: {integrity: sha512-8trNmPxdAy3W620WKDpaS65NlM5yAumod6XeC4LOb+jxlkG4IVcp68c6dXY2ev+uT4U1PtG57YDV6EGAXN0GbQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0 || ^9.0.0
@ -2570,16 +2536,6 @@ packages:
resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==}
engines: {node: '>=8'}
typescript-eslint@7.18.0:
resolution: {integrity: sha512-PonBkP603E3tt05lDkbOMyaxJjvKqQrXsnow72sVeOFINDE/qNmnnd+f9b4N+U7W6MXnnYyrhtmF2t08QWwUbA==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
typescript@5.5.4:
resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==}
engines: {node: '>=14.17'}
@ -2867,7 +2823,7 @@ snapshots:
'@antfu/install-pkg': 0.3.5
'@clack/prompts': 0.7.0
'@stylistic/eslint-plugin': 2.6.2(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/eslint-plugin': 8.1.0(@typescript-eslint/parser@7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/eslint-plugin': 8.1.0(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/parser': 8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@vitest/eslint-plugin': 1.0.3(@typescript-eslint/utils@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)(vitest@2.0.5(@types/node@20.14.15)(jsdom@24.1.1)(stylus@0.57.0))
eslint: 9.9.0(jiti@1.21.6)
@ -3456,28 +3412,10 @@ snapshots:
'@types/web-bluetooth@0.0.20': {}
'@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)':
'@typescript-eslint/eslint-plugin@8.1.0(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)':
dependencies:
'@eslint-community/regexpp': 4.11.0
'@typescript-eslint/parser': 7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/scope-manager': 7.18.0
'@typescript-eslint/type-utils': 7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/utils': 7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 7.18.0
eslint: 9.9.0(jiti@1.21.6)
graphemer: 1.4.0
ignore: 5.3.2
natural-compare: 1.4.0
ts-api-utils: 1.3.0(typescript@5.5.4)
optionalDependencies:
typescript: 5.5.4
transitivePeerDependencies:
- supports-color
'@typescript-eslint/eslint-plugin@8.1.0(@typescript-eslint/parser@7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)':
dependencies:
'@eslint-community/regexpp': 4.11.0
'@typescript-eslint/parser': 7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/parser': 8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/scope-manager': 8.1.0
'@typescript-eslint/type-utils': 8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/utils': 8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
@ -3492,19 +3430,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/parser@7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)':
dependencies:
'@typescript-eslint/scope-manager': 7.18.0
'@typescript-eslint/types': 7.18.0
'@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 7.18.0
debug: 4.3.6
eslint: 9.9.0(jiti@1.21.6)
optionalDependencies:
typescript: 5.5.4
transitivePeerDependencies:
- supports-color
'@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)':
dependencies:
'@typescript-eslint/scope-manager': 8.1.0
@ -3528,18 +3453,6 @@ snapshots:
'@typescript-eslint/types': 8.1.0
'@typescript-eslint/visitor-keys': 8.1.0
'@typescript-eslint/type-utils@7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)':
dependencies:
'@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4)
'@typescript-eslint/utils': 7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
debug: 4.3.6
eslint: 9.9.0(jiti@1.21.6)
ts-api-utils: 1.3.0(typescript@5.5.4)
optionalDependencies:
typescript: 5.5.4
transitivePeerDependencies:
- supports-color
'@typescript-eslint/type-utils@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)':
dependencies:
'@typescript-eslint/typescript-estree': 8.1.0(typescript@5.5.4)
@ -4289,7 +4202,7 @@ snapshots:
- supports-color
- typescript
eslint-plugin-promise@6.6.0(eslint@9.9.0(jiti@1.21.6)):
eslint-plugin-promise@7.1.0(eslint@9.9.0(jiti@1.21.6)):
dependencies:
eslint: 9.9.0(jiti@1.21.6)
@ -4338,7 +4251,7 @@ snapshots:
dependencies:
eslint: 9.9.0(jiti@1.21.6)
optionalDependencies:
'@typescript-eslint/eslint-plugin': 8.1.0(@typescript-eslint/parser@7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/eslint-plugin': 8.1.0(@typescript-eslint/parser@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
eslint-plugin-vue-scoped-css@2.8.1(eslint@9.9.0(jiti@1.21.6))(vue-eslint-parser@9.4.3(eslint@9.9.0(jiti@1.21.6))):
dependencies:
@ -5411,17 +5324,6 @@ snapshots:
type-fest@0.8.1: {}
typescript-eslint@7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4):
dependencies:
'@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/parser': 7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
'@typescript-eslint/utils': 7.18.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)
eslint: 9.9.0(jiti@1.21.6)
optionalDependencies:
typescript: 5.5.4
transitivePeerDependencies:
- supports-color
typescript@5.5.4: {}
ufo@1.5.4: {}

View file

@ -31,7 +31,7 @@ const apiClient = useApiClient();
const { notify } = useNotifications();
const i18n = useI18n();
// TODO reenable with eslint-plugin-promise eslint-disable-next-line promise/prefer-await-to-callbacks
// eslint-disable-next-line promise/prefer-await-to-callbacks
apiClient.setErrorHandler((err) => {
if (err.status === 404) {
notify({ title: i18n.t('errors.not_found'), type: 'error' });

View file

@ -18,11 +18,11 @@ async function waitForState<T>(ref: Ref<T>, expected: T): Promise<void> {
});
}
// TODO enable again with eslint-plugin-promise eslint-disable-next-line promise/prefer-await-to-callbacks
// eslint-disable-next-line promise/prefer-await-to-callbacks
export const mountComposition = (cb: () => void) => {
const wrapper = shallowMount({
setup() {
// TODO enable again with eslint-plugin-promise eslint-disable-next-line promise/prefer-await-to-callbacks
// eslint-disable-next-line promise/prefer-await-to-callbacks
cb();
return {};
},

View file

@ -101,7 +101,7 @@ export default class ApiClient {
const events = new EventSource(_path);
events.onmessage = (event) => {
const data = JSON.parse(event.data as string) as T;
// TODO enable again with eslint-plugin-promise eslint-disable-next-line promise/prefer-await-to-callbacks
// eslint-disable-next-line promise/prefer-await-to-callbacks
callback(data);
};

View file

@ -398,7 +398,7 @@ export default class WoodpeckerClient extends ApiClient {
return this._post(`/api/repos/repair`);
}
// TODO enable again with eslint-plugin-promise eslint-disable-next-line promise/prefer-await-to-callbacks
// eslint-disable-next-line promise/prefer-await-to-callbacks
on(callback: (data: { pipeline?: Pipeline; repo?: Repo }) => void): EventSource {
return this._subscribe('/api/stream/events', callback, {
reconnect: true,
@ -409,7 +409,7 @@ export default class WoodpeckerClient extends ApiClient {
repoId: number,
pipeline: number,
step: number,
// TODO enable again with eslint-plugin-promise eslint-disable-next-line promise/prefer-await-to-callbacks
// eslint-disable-next-line promise/prefer-await-to-callbacks
callback: (data: PipelineLog) => void,
): EventSource {
return this._subscribe(`/api/stream/logs/${repoId}/${pipeline}/${step}`, callback, {

View file

@ -78,7 +78,7 @@ export default defineConfig({
copyFile(
`node_modules/dayjs/esm/locale/${langName}.js`,
`src/assets/dayjsLocales/${name}.js`,
// TODO enable with eslint-plugin-promise eslint-disable-next-line promise/prefer-await-to-callbacks
// eslint-disable-next-line promise/prefer-await-to-callbacks
(err) => {
if (err) {
throw err;