diff --git a/.eslintrc.js b/.eslintrc.js index d5f44b0b5..3f59d0835 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,18 +10,21 @@ // ESLint configuration // http://eslint.org/docs/user-guide/configuring module.exports = { - parser: 'babel-eslint', + parser: '@typescript-eslint/parser', extends: [ 'airbnb', - 'plugin:flowtype/recommended', 'plugin:css-modules/recommended', 'prettier', - 'prettier/flowtype', 'prettier/react', ], - plugins: ['flowtype', 'css-modules', 'prettier'], + plugins: ['@typescript-eslint/eslint-plugin', 'css-modules', 'prettier'], + + parserOptions: { + sourceType: 'module', + project: './tsconfig.json', + }, globals: { __DEV__: true, @@ -46,6 +49,15 @@ module.exports = { }, ], + // Allow only special identifiers + // https://eslint.org/docs/rules/no-underscore-dangle + 'no-underscore-dangle': [ + 'error', + { + allow: ['__typename', '__DEV__'], + }, + ], + // Prefer destructuring from arrays and objects // http://eslint.org/docs/rules/prefer-destructuring 'prefer-destructuring': [ @@ -78,7 +90,7 @@ module.exports = { // Allow .js files to use JSX syntax // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md - 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx'] }], + 'react/jsx-filename-extension': [1, { extensions: ['.ts', '.tsx'] }], // Functional and class components are equivalent from React’s point of view // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md @@ -87,15 +99,32 @@ module.exports = { // ESLint plugin for prettier formatting // https://github.com/prettier/eslint-plugin-prettier 'prettier/prettier': 'error', - }, - settings: { - // Allow absolute paths in imports, e.g. import Button from 'components/Button' - // https://github.com/benmosher/eslint-plugin-import/tree/master/resolvers - 'import/resolver': { - node: { - moduleDirectory: ['node_modules', 'src'], + 'react/forbid-prop-types': 'off', + 'react/destructuring-assignment': 'off', + // TypeScript types checks prop-types + 'react/prop-types': 'off', + + // PropTypes and states are typed by Flow basically, but Flow cannot type defaultProps. + 'react/require-default-props': 'off', + + // Cannot config .ts, .tsx resolution + 'import/no-unresolved': 'off', + + 'import/no-webpack-loader-syntax': 'off', + + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + vars: 'local', + args: 'after-used', + ignoreRestSiblings: false, + argsIgnorePattern: '^_', }, - }, + ], + + // Type variables by Codegen can not be camelcase. + camelcase: 'off', }, }; diff --git a/.flowconfig b/.flowconfig index f111649a9..4e334642c 100644 --- a/.flowconfig +++ b/.flowconfig @@ -7,5 +7,14 @@ [include] [options] -module.system.node.resolve_dirname=node_modules -module.system.node.resolve_dirname=src +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectError +module.file_ext=.js +module.file_ext=.jsx +module.file_ext=.json +module.file_ext=.css +module.file_ext=.scss +module.file_ext=.graphql +module.name_mapper.extension='json' -> 'empty/object' +module.name_mapper.extension='css' -> 'empty/object' +module.name_mapper.extension='scss' -> 'empty/object' +module.name_mapper.extension='graphql' -> 'empty/object' diff --git a/.gitignore b/.gitignore index 1a0fe2e26..0816d0cd2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ node_modules/ # Compiled output build +# Generate Types +__generated__ + # Runtime data database.sqlite diff --git a/.travis.yml b/.travis.yml index e2790b341..743316249 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: node_js node_js: - 'stable' + - '10' - '8' - - '6' env: - CXX=g++-4.8 addons: diff --git a/README.md b/README.md index 545e088b3..c8378dad0 100644 --- a/README.md +++ b/README.md @@ -21,31 +21,29 @@ and newcomers to the industry. Hiring
- ### Getting Started - * Follow the [getting started guide](./docs/getting-started.md) to download and run the project - ([Node.js](https://nodejs.org/) >= 6.5) - * Check the [code recipes](./docs/recipes) used in this boilerplate, or share yours - +- Follow the [getting started guide](./docs/getting-started.md) to download and run the project + ([Node.js](https://nodejs.org/) >= 6.5) +- Check the [code recipes](./docs/recipes) used in this boilerplate, or share yours ### Customization The `master` branch of React Starter Kit doesn't include a Flux implementation or any other -advanced integrations. Nevertheless, we have some integrations available to you in *feature* +advanced integrations. Nevertheless, we have some integrations available to you in _feature_ branches that you can use either as a reference or merge into your project: - * [feature/redux](https://github.com/kriasoft/react-starter-kit/tree/feature/redux) ([PR](https://github.com/kriasoft/react-starter-kit/pull/1084)) - — isomorphic Redux by [Pavel Lang](https://github.com/langpavel) - (see [how to integrate Redux](./docs/recipes/how-to-integrate-redux.md)) (based on `master`) - * [feature/apollo](https://github.com/kriasoft/react-starter-kit/tree/feature/apollo) ([PR](https://github.com/kriasoft/react-starter-kit/pull/1147)) - — isomorphic Apollo Client by [Pavel Lang](https://github.com/langpavel) - (see [Tracking PR #1147](https://github.com/kriasoft/react-starter-kit/pull/1147)) (based on `feature/redux`) - * [feature/react-intl](https://github.com/kriasoft/react-starter-kit/tree/feature/react-intl) ([PR](https://github.com/kriasoft/react-starter-kit/pull/1135)) - — isomorphic Redux and React Intl by [Pavel Lang](https://github.com/langpavel) - (see [how to integrate React Intl](./docs/recipes/how-to-integrate-react-intl.md)) (based on `feature/apollo`) - * [feature/apollo-pure](https://github.com/kriasoft/react-starter-kit/tree/feature/apollo-pure) ([PR](https://github.com/kriasoft/react-starter-kit/pull/1664)) - — bare Apollo codebase by [piglovesyou](https://github.com/piglovesyou) (based on `master`) +- [feature/redux](https://github.com/kriasoft/react-starter-kit/tree/feature/redux) ([PR](https://github.com/kriasoft/react-starter-kit/pull/1084)) + — isomorphic Redux by [Pavel Lang](https://github.com/langpavel) + (see [how to integrate Redux](./docs/recipes/how-to-integrate-redux.md)) (based on `master`) +- [feature/apollo](https://github.com/kriasoft/react-starter-kit/tree/feature/apollo) ([PR](https://github.com/kriasoft/react-starter-kit/pull/1147)) + — isomorphic Apollo Client by [Pavel Lang](https://github.com/langpavel) + (see [Tracking PR #1147](https://github.com/kriasoft/react-starter-kit/pull/1147)) (based on `feature/redux`) +- [feature/react-intl](https://github.com/kriasoft/react-starter-kit/tree/feature/react-intl) ([PR](https://github.com/kriasoft/react-starter-kit/pull/1135)) + — isomorphic Redux and React Intl by [Pavel Lang](https://github.com/langpavel) + (see [how to integrate React Intl](./docs/recipes/how-to-integrate-react-intl.md)) (based on `feature/apollo`) +- [feature/apollo-pure](https://github.com/kriasoft/react-starter-kit/tree/feature/apollo-pure) ([PR](https://github.com/kriasoft/react-starter-kit/pull/1664)) + — bare Apollo codebase by [piglovesyou](https://github.com/piglovesyou) (based on `master`) You can see status of most reasonable merge combination as [PRs labeled as `TRACKING`](https://github.com/kriasoft/react-starter-kit/labels/TRACKING) @@ -53,7 +51,6 @@ If you think that any of these features should be on `master`, or vice versa, so removed from the `master` branch, please [let us know](https://gitter.im/kriasoft/react-starter-kit). We love your feedback! - ### ComparisonReact, History, - Redux | React, History, - Redux |