-
Notifications
You must be signed in to change notification settings - Fork 1
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move to TypeScript #9
Changes from 14 commits
26ec536
600dc8d
98773bc
367a1b3
4cd0220
7f1301a
edfbaba
5fe08ff
9dd0d73
93051b1
42084e1
46c86fa
ed9ab8e
42b21d3
a1f70a1
74bcaff
ab6388f
054c269
03b0366
e50975e
0c49389
9c21ca0
b76f3d1
55d73c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,45 +1,12 @@ | ||||||
module.exports = { | ||||||
env: { | ||||||
browser: true, | ||||||
es6: true, | ||||||
}, | ||||||
extends: [ | ||||||
'standard', | ||||||
'standard-react', | ||||||
'prettier/react', | ||||||
'react-app', | ||||||
'prettier/@typescript-eslint', | ||||||
'plugin:prettier/recommended', | ||||||
], | ||||||
parser: 'babel-eslint', | ||||||
parserOptions: { | ||||||
ecmaFeatures: { | ||||||
experimentalObjectRestSpread: true, | ||||||
jsx: true, | ||||||
}, | ||||||
sourceType: 'module', | ||||||
}, | ||||||
plugins: ['prettier', 'react', 'react-hooks'], | ||||||
rules: { | ||||||
'react/prop-types': 'warn', | ||||||
'react-hooks/rules-of-hooks': 'error', | ||||||
'react-hooks/exhaustive-deps': 'error', | ||||||
'import/no-unresolved': [ | ||||||
andy-hook marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
'error', | ||||||
{ ignore: ['^react(-dom)?$', '^styled-components$'] }, | ||||||
], | ||||||
'promise/no-nesting': ['off'], | ||||||
'linebreak-style': ['error', 'unix'], | ||||||
curly: 'error', | ||||||
}, | ||||||
settings: { | ||||||
react: { | ||||||
pragma: 'React', | ||||||
version: '16.6', | ||||||
version: '999.999.999', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would you think about doing this?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good idea! but I think keeping the config free of side effects would be simpler and more portable. For consistency I've reverted to being explicit with the version and pragma. |
||||||
}, | ||||||
}, | ||||||
overrides: [ | ||||||
{ | ||||||
files: ['**/*.test.js'], | ||||||
env: { jest: true }, | ||||||
}, | ||||||
], | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
"singleQuote": true | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<title>Simple Viewport</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="./index.js"></script> | ||
|
||
<body style="margin: 0"> | ||
<div id="root"></div> | ||
<script src="./index.tsx"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
{ | ||
"scripts": { | ||
"start": "parcel serve index.html", | ||
"start": "parcel index.html", | ||
"build": "parcel build index.html" | ||
}, | ||
"dependencies": { | ||
"babel-polyfill": "^6.26.0", | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"use-viewport": "link:../.." | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.3", | ||
"parcel": "^1.12.4" | ||
"@types/react": "^16.9.49", | ||
"@types/react-dom": "^16.9.8", | ||
"parcel": "^1.12.3", | ||
"typescript": "^3.4.5" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"target": "es5", | ||
"module": "commonjs", | ||
"jsx": "react", | ||
"moduleResolution": "node", | ||
"noImplicitAny": false, | ||
"noUnusedLocals": false, | ||
"noUnusedParameters": false, | ||
"removeComments": true, | ||
"strictNullChecks": true, | ||
"preserveConstEnums": true, | ||
"sourceMap": true, | ||
"lib": ["es2015", "es2016", "dom"], | ||
"types": ["node"], | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the ejected defaults via
yarn lint --write-file
so I could use the hooks plugin. Do we want to be explicit here with our own standards?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I've never looked, but do you know if there a good way to diff between different eslint configs?
Since we're currently in a reset phase, this may also be a good time to standardize an eslint config for JS and TS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this and I really like the idea of standardising around a single opinionated tool. The more of this configuration we can offload the more we can focus on the building, so for the TS projects I was thinking we could just straight up use the provided values and leave it there, see how we get on?
These customisations I made were actually unnecessary, the tool ships with all the setting we would want, my editor just couldn't see the configuration.
I followed their suggested fix jaredpalmer/tsdx#379 (comment) and exported unedited default settings in 9dd0d73
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, so VSC can't automatically resolve TSDX's default config without ejecting them?
I've been procrastinating on setting up "standard" linting configs in https://github.com/aragon/github for forever, but now is a good chance. I'll get a structure going—I was mainly thinking of packaging something like
eslint-config-aragon-ts-react
(and etc. for other environments).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a package for our config would be lovely! And yeah, for some reason VSCode sometimes has a hard time reading configs with TSDX 😅