-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Typescript support * Apply CR suggestions Co-authored-by: Matthew Peveler <matt.peveler@gmail.com> * Use default tsconfig for dev and tsconfig.build for the build It makes the text editor properly parse and lint any code during development. Without this change the test files were not being transpiled properly by my text editor. * Drop Babel from src/browser code We don't need it anymore because of Typescript Co-authored-by: Matthew Peveler <matt.peveler@gmail.com>
- Loading branch information
1 parent
7cb9e5f
commit 9a63a8f
Showing
56 changed files
with
1,808 additions
and
2,275 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
module.exports = { | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2020, | ||
}, | ||
extends: ['eslint:recommended', 'prettier'], | ||
plugins: ['prettier'], | ||
rules: { | ||
'prettier/prettier': ['error'], | ||
}, | ||
env: { | ||
es2017: true, | ||
node: true, | ||
mocha: true, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['src/renderer/**/*.js', 'src/renderer/**/*.jsx'], | ||
plugins: ['import', 'react', 'prettier'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:react/recommended', | ||
'plugin:jsx-a11y/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
env: { | ||
node: true, | ||
browser: true, | ||
es6: true, | ||
}, | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2020, | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
settings: { | ||
react: { version: 'detect' }, | ||
}, | ||
globals: { | ||
$: true, | ||
}, | ||
rules: { | ||
'no-unused-vars': 'off', | ||
camelcase: [ | ||
'error', | ||
{ | ||
properties: 'never', | ||
ignoreDestructuring: false, | ||
allow: ['^UNSAFE_'], | ||
}, | ||
], | ||
'no-use-before-define': 0, | ||
'react/jsx-closing-bracket-location': 0, | ||
'react/jsx-first-prop-new-line': 0, | ||
'react/jsx-uses-react': 2, | ||
'react/jsx-uses-vars': 2, | ||
'react/react-in-jsx-scope': 2, | ||
'react/forbid-prop-types': 0, | ||
'space-before-function-paren': 0, | ||
'func-names': 0, | ||
'class-methods-use-this': 0, | ||
'no-restricted-syntax': 0, | ||
'no-bitwise': 0, | ||
'prefer-destructuring': 0, | ||
'react/button-has-type': 0, | ||
'react/jsx-no-bind': 0, | ||
'react/destructuring-assignment': 0, | ||
'react/no-access-state-in-setstate': 0, | ||
'react/no-array-index-key': 0, | ||
'react/no-find-dom-node': 0, | ||
'react/no-string-refs': 0, | ||
'react/no-unused-prop-types': 0, | ||
'react/no-unused-state': 0, | ||
'react/prefer-stateless-function': 0, | ||
'react/prop-types': 0, | ||
'react/require-default-props': 0, | ||
'react/static-property-placement': ['error', 'static public field'], | ||
'jsx-a11y/anchor-is-valid': 0, | ||
'jsx-a11y/no-autofocus': 0, | ||
'jsx-a11y/click-events-have-key-events': 0, | ||
'jsx-a11y/label-has-associated-control': 0, | ||
'jsx-a11y/label-has-for': 0, | ||
'jsx-a11y/no-noninteractive-tabindex': 0, | ||
'jsx-a11y/no-static-element-interactions': 0, | ||
}, | ||
}, | ||
{ | ||
files: ['src/**/*.ts', 'src/**/*.tsx'], | ||
env: { browser: true, es6: true, node: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:react/recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
globals: { NodeJS: true, Atomics: 'readonly', SharedArrayBuffer: 'readonly' }, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaFeatures: { jsx: true }, | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
project: './tsconfig.json', | ||
}, | ||
plugins: ['prettier', '@typescript-eslint'], | ||
rules: { | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', // temporary disable for tests | ||
}, | ||
settings: { | ||
react: { version: 'detect' }, | ||
}, | ||
}, | ||
{ | ||
files: ['test/**/*.ts', 'test/**/*.tsx'], | ||
env: { browser: true, es6: true, node: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:react/recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
globals: { NodeJS: true, Atomics: 'readonly', SharedArrayBuffer: 'readonly' }, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaFeatures: { jsx: true }, | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
project: './tsconfig.json', | ||
}, | ||
plugins: ['prettier', '@typescript-eslint'], | ||
rules: { | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', // temporary disable for tests | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
}, | ||
settings: { | ||
react: { version: 'detect' }, | ||
}, | ||
}, | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"*.{js,jsx}": ["eslint --fix"], | ||
"*.{js,jsx,json,css,md}": ["prettier --write"] | ||
"*.{js,jsx,ts,tsx}": ["eslint --fix"], | ||
"*.{js,jsx,ts,tsx,json,css,md}": ["prettier --write"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
chrome: 53, | ||
}, | ||
useBuiltIns: 'usage', | ||
corejs: { version: 3, proposals: true }, | ||
}, | ||
], | ||
'@babel/preset-react', | ||
'@babel/preset-typescript', | ||
], | ||
plugins: [ | ||
[ | ||
'@babel/plugin-proposal-class-properties', | ||
{ | ||
loose: true, | ||
}, | ||
], | ||
], | ||
}; |
Oops, something went wrong.