0
0
Fork 0

[Proposal] Make able to write React in Typescript (#16210)

Co-authored-by: berlysia <berlysia@gmail.com>
Co-authored-by: fusagiko / takayamaki <takayamaki@users.noreply.github.com>
This commit is contained in:
fusagiko / takayamaki 2023-04-03 10:31:39 +09:00 committed by GitHub
parent 2f7c3cb628
commit 4520e6473a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1099 additions and 211 deletions

View file

@ -20,13 +20,14 @@ module.exports = {
ATTACHMENT_HOST: false,
},
parser: '@babel/eslint-parser',
parser: '@typescript-eslint/parser',
plugins: [
'react',
'jsx-a11y',
'import',
'promise',
'@typescript-eslint',
],
parserOptions: {
@ -41,14 +42,13 @@ module.exports = {
presets: ['@babel/react', '@babel/env'],
},
},
extends: [
'plugin:import/typescript',
],
settings: {
react: {
version: 'detect',
},
'import/extensions': [
'.js', '.jsx',
],
'import/ignore': [
'node_modules',
'\\.(css|scss|json)$',
@ -56,7 +56,7 @@ module.exports = {
'import/resolver': {
node: {
paths: ['app/javascript'],
extensions: ['.js', '.jsx'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
@ -97,7 +97,8 @@ module.exports = {
'no-self-assign': 'off',
'no-trailing-spaces': 'warn',
'no-unused-expressions': 'error',
'no-unused-vars': [
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
@ -116,7 +117,7 @@ module.exports = {
semi: 'error',
'valid-typeof': 'error',
'react/jsx-filename-extension': ['error', { 'allow': 'as-needed' }],
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', 'tsx'] }],
'react/jsx-boolean-value': 'error',
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
'react/jsx-curly-spacing': 'error',
@ -192,6 +193,8 @@ module.exports = {
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'import/newline-after-import': 'error',