Skip to content

Commit

Permalink
chore: update tsconfig and set jsxRuntime as automatic (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpedroschmitz authored May 23, 2022
1 parent 99c5c8e commit 76c7b02
Show file tree
Hide file tree
Showing 11 changed files with 1,818 additions and 2,225 deletions.
86 changes: 22 additions & 64 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
{
"env": {
"browser": true,
"es6": true,
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2019,
"ecmaVersion": "latest",
"sourceType": "module"
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
"env": {
"browser": true,
"es6": true,
"node": true,
"jest": true
},
"plugins": ["react", "react-hooks", "jsx-a11y", "prettier", "jest"],
"plugins": ["react", "jsx-a11y", "prettier", "jest", "@typescript-eslint"],
"extends": [
"plugin:react/recommended",
"airbnb",
"prettier",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jest/recommended",
"plugin:jest/style"
"standard",
"plugin:prettier/recommended"
],
"rules": {
"jest/prefer-strict-equal": "error",
"jest/prefer-to-have-length": "warn",
"prettier/prettier": "error",
"import/prefer-default-export": "off",
"react/prop-types": "off",
"react/jsx-filename-extension": "off",
"react/jsx-props-no-spreading": "off",
"react/react-in-jsx-scope": "off",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": [
"error",
{
Expand All @@ -54,56 +49,19 @@
"jsx": "never"
}
],
"react/function-component-definition": [
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"quotes": "off",
"@typescript-eslint/quotes": [
2,
"backtick",
{
"namedComponents": "function-declaration"
"avoidEscape": true
}
]
],
"@typescript-eslint/no-unused-vars": [2, { "argsIgnorePattern": "^_" }]
},
"overrides": [
{
"files": "**/*.+(ts|tsx)",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint/eslint-plugin"],
"extends": [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"no-use-before-define": [0],
"@typescript-eslint/no-use-before-define": [1],
"import/no-unresolved": 0,
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/*.test.ts",
"**/*.spec.ts",
"**/*.test.tsx",
"**/*.spec.tsx"
]
}
],
"quotes": "off",
"@typescript-eslint/quotes": [
2,
"backtick",
{
"avoidEscape": true
}
],
"@typescript-eslint/no-unused-vars": [2, { "argsIgnorePattern": "^_" }]
}
}
],
"settings": {
"import/resolver": {
"typescript": {
Expand Down
1 change: 1 addition & 0 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const config: GatsbyConfig = {
// Since `gatsby-plugin-typescript` is automatically included in Gatsby you
// don't need to define it here (just if you need to change the options)
plugins: [],
jsxRuntime: `automatic`,
};

export default config;
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
rootDir: '.',
globals: {
'ts-jest': {
tsconfig: 'tsconfig.spec.json',
tsconfig: 'tsconfig.json',
},
__PATH_PREFIX__: ``,
__BASE_PATH__: ``,
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@
"commitizen": "4.2.4",
"cz-conventional-changelog": "3.3.0",
"eslint": "8.15.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "8.5.0",
"eslint-config-standard": "17.0.0",
"eslint-import-resolver-typescript": "2.7.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jest": "26.2.2",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-n": "15.2.0",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-promise": "6.0.0",
"eslint-plugin-react": "7.30.0",
"eslint-plugin-react-hooks": "4.5.0",
"husky": "8.0.1",
Expand Down
1 change: 0 additions & 1 deletion src/components/Title.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen } from '@testing-library/react';

import Title from '@/components/Title';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Title.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from 'react';
import { ReactNode } from 'react';

type TitleProps = {
children: ReactNode;
Expand Down
2 changes: 0 additions & 2 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function NotFound() {
return (
<main>
Expand Down
2 changes: 0 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Title from '@/components/Title';

export default function Home() {
Expand Down
18 changes: 7 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"target": "esnext",
"lib": ["dom", "esnext"],
"jsx": "react-jsx",
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
Expand Down
7 changes: 0 additions & 7 deletions tsconfig.spec.json

This file was deleted.

Loading

0 comments on commit 76c7b02

Please sign in to comment.