[Solved] Vue3+ts+eslint Error: warning Unexpected any. Specify a different type, warning Delete `·` , Missing return type on function, Require statement not part of import statement

1. Warning: warning unexpected any. Specify a different type @typescript eslint/no explicit any

Solution: turn off warnings of type any.

// In the .eslintrc.js file, find the rules and add a line of code
"@typescript-eslint/no-explicit-any": ["off"]

After adding, you can run the project again.

2. When using eslint, always remind warning delete ` · ` prettier/prettier or 405:15 warning insert ` ··· ` prettier

Solution: just executable code

npm run lint --fix

It will be modified automatically after execution. I see here that the single quotation mark is changed to double quotation mark.

3. Warning: missing return type on function (@typescript-eslint/explicit-module-boundary-types) at src\main.ts:32:8

Solution: add rules to the. Eslintrc.js file to disable TA

"rules": {
    "@typescript-eslint/explicit-module-boundary-types": "off"
},

4. Require statement not part of import statement.(@typescript-eslint/no-var-requires)

// in vue.config.js:
const path = require('path')

// Error:
Require statement not part of import statement.(@typescript-eslint/no-var-requires)

Solution: add the following content to the rules attribute in.Eslintrc.js:

rules: {
    '@typescript-eslint/no-var-requires': 0
}

Similar Posts: