Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add recommended-type-checked#68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
segevfiner wants to merge1 commit intovuejs:main
base:main
Choose a base branch
Loading
fromsegevfiner:recommended-type-checked
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletionpackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,8 @@
"main": "index.js",
"files": [
"index.js",
"recommended.js"
"recommended.js",
"recommended-type-checked.js"
],
"scripts": {
"test": "jest"
Expand Down
52 changes: 52 additions & 0 deletionsrecommended-type-checked.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
module.exports = {
extends: [
require.resolve('./index'),
'plugin:@typescript-eslint/recommended-type-checked'
],

// the ts-eslint recommended ruleset sets the parser so we need to set it back
parser: require.resolve('vue-eslint-parser'),

parserOptions: {
parser: require('typescript-eslint-parser-for-extra-files')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@segevfiner Curiously, what problems were you running into that required this dependency?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The rules that use type checking see the linked issues in the PR description.

ethanchristensen01 reacted with thumbs up emoji
},

rules: {
// this rule, if on, would require explicit return type on the `render` function
'@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: [
{
files: ['shims-tsx.d.ts'],
rules: {
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off'
}
},
{
files: ['*.js', '*.cjs'],
rules: {
// in plain CommonJS modules, you can't use `import foo = require('foo')` to pass this rule, so it has to be disabled
'@typescript-eslint/no-var-requires': 'off'
}
}
]
}

[8]ページ先頭

©2009-2025 Movatter.jp