Skip to content

Commit

Permalink
feat: migrate eslint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
chantouchsek committed May 8, 2024
1 parent f1e174b commit cdc159c
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 546 deletions.
33 changes: 0 additions & 33 deletions .eslintrc

This file was deleted.

19 changes: 19 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginVue from 'eslint-plugin-vue'

export default [
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
...pluginVue.configs['flat/vue2-essential'],
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
ignores: ['**/node_modules/**', '**/dist/**', '**/build/**'],
},
]
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"release": "standard-version && git push --follow-tags origin main && yarn publish",
"clean": "rimraf dist",
"prepare": "husky",
"lint:js": "eslint --ext \".js,.ts\" --ignore-path .gitignore .",
"lint:js": "eslint .",
"lint:prettier": "prettier --check .",
"lint": "yarn lint:js && yarn lint:prettier",
"lintfix": "prettier --write --list-different . && yarn lint:js --fix"
Expand Down Expand Up @@ -49,6 +49,7 @@
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@eslint/js": "^9.2.0",
"@nuxt/types": "^2.17.3",
"@types/lodash": "^4.17.1",
"@types/node": "^20.12.10",
Expand All @@ -58,22 +59,21 @@
"@vitest/coverage-v8": "^1.6.0",
"@vue/test-utils": "^1.3.6",
"axios-mock-adapter": "^1.22.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint": "^9.2.0",
"eslint-plugin-vue": "^9.25.0",
"globals": "^15.1.0",
"husky": "^9.0.11",
"jsdom": "^22.1.0",
"lint-staged": ">=15.2.2",
"lint-staged": "^15.2.2",
"nodemon": "^3.1.0",
"nuxt": "^2.17.3",
"prettier": "^2.8.8",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"sass": "^1.77.0",
"standard-version": "^9.5.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.8.0",
"vite": "^5.2.11",
"vitest": "^1.6.0",
"vue": "^2.7.16"
Expand Down
5 changes: 4 additions & 1 deletion src/core/BaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export default class BaseService {
ignoreQueryPrefix: true,
}

constructor(readonly endpoint: string, public parameters: SimpleObject<any> = {}) {}
constructor(
readonly endpoint: string,
public parameters: SimpleObject<any> = {},
) {}

get $http() {
return BaseService.$http
Expand Down
6 changes: 5 additions & 1 deletion src/core/Validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { castArray, cloneDeep, get, has, omit, replace } from 'lodash'
import { is, toCamelCase, toSnakeCase } from '../util'

class Validator {
constructor(public errors: SimpleObject<any> = {}, public processing = false, public successful = false) {}
constructor(
public errors: SimpleObject<any> = {},
public processing = false,
public successful = false,
) {}

add(field: string, message: string, forceUpdate?: boolean) {
if (forceUpdate || this.missed(field)) {
Expand Down
2 changes: 1 addition & 1 deletion src/util/objects.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function isFile(object: any): boolean {
export function isFile(object: File | FileList): boolean {
return object instanceof File || object instanceof FileList
}
export function is(errors: string[], errorsToCheck: string[] | string): boolean {
Expand Down

0 comments on commit cdc159c

Please sign in to comment.