Skip to content

Commit

Permalink
feat: apply no-var, prefer-const, prefer-reset-params, `prefer-…
Browse files Browse the repository at this point in the history
…spread` globally
  • Loading branch information
haoqunjiang committed Jun 10, 2022
1 parent 9d2bc08 commit 60b143b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,23 @@ module.exports = {

rules: {
// this rule, if on, would require explicit return type on the `render` function
'@typescript-eslint/explicit-function-return-type': 'off'
'@typescript-eslint/explicit-function-return-type': 'off',

// The following rules are enabled in an `overrides` field in the
// `@typescript-eslint/recommended` ruleset, only turned on for TypeScript source modules
// <https://github.com/typescript-eslint/typescript-eslint/blob/cb2d44650d27d8b917e8ce19423245b834db29d2/packages/eslint-plugin/src/configs/eslint-recommended.ts#L27-L30>

// But as ESLint cannot precisely target `<script lang="ts">` blocks and skip normal `<script>`s,
// no TypeScript code in `.vue` files would be checked against these rules.

// So we now enable them globally.
// That would also check plain JavaScript files, which diverges a little from
// the original intention of the `@typescript-eslint/recommended` rulset.
// But it should be mostly fine.
'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more
'prefer-const': 'error', // ts provides better types with const
'prefer-rest-params': 'error', // ts provides better types with rest args over arguments
'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply
},

overrides: [
Expand Down

0 comments on commit 60b143b

Please sign in to comment.