Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.
Open

V3 #3

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e30660b
feat(prettier): add prettier, update eslint, use prettier on precommit
olegafx Aug 25, 2018
7a31bf4
chore(.prettierignore): ignore some root files
olegafx Aug 25, 2018
8e553ef
style(root): use prettier on root js files
olegafx Aug 25, 2018
49d6562
fix(webpack.config.js): resolve only one version of React
olegafx Aug 25, 2018
456f8d7
style(src): reformat all js files inside
olegafx Aug 25, 2018
54d2b54
fix(index.js): render React only when DOM is available
olegafx Aug 26, 2018
92429c4
refactor(index.html): rename container element
olegafx Aug 26, 2018
20685db
refactor(index.js): change order of import statements
olegafx Aug 26, 2018
cbbcb52
refactor(webpack.config): extract common config, add dev config
olegafx Aug 26, 2018
2624452
fix(package.json): add missing lint-staged script
olegafx Aug 26, 2018
57b9285
feat(config): allow app and hmr port change
olegafx Aug 26, 2018
3c486bf
chore(package.json): update husky to v1 rc
olegafx Aug 26, 2018
deeae90
fix(package.json): remove pre-commit package (overlaps with husky)
olegafx Aug 26, 2018
a0b717c
fix(webpack.config.js): transpile src directory only
olegafx Aug 26, 2018
a30cbb1
feat(package.json): upgrade webpack v1 to v2
olegafx Aug 26, 2018
43a5560
feat(package.json): upgrade webpack v2 to v3
olegafx Aug 26, 2018
3701082
feat(package.json): upgrade webpack v3 to v4
olegafx Aug 27, 2018
c1bf9e3
feat(package.json): upgrade babel v6 to v7, remove babel-runtime
olegafx Aug 27, 2018
8aea01c
feat(package.json): upgrade whatwg-fetch v1 to v2
olegafx Aug 27, 2018
7359198
chore(package.json): remove why-did-you-update, it's better to use re…
olegafx Aug 27, 2018
89b8ff7
feat(package.json): upgrade react v15 to v16, upgrade react-router v4…
olegafx Aug 27, 2018
c5eb778
feat(package.json): migrate from react-router v4 to reach-router v1
olegafx Aug 27, 2018
7df7926
feat(package.json): add webpack size-plugin
olegafx Aug 27, 2018
86a973e
feat(package.json): configure jest
olegafx Aug 27, 2018
57293f3
feat(package.json): configure cypress
olegafx Aug 28, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

57 changes: 24 additions & 33 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,50 +1,41 @@
{
"env": {
"browser": true,
"cypress/globals": true,
"es6": true,
"jquery": true,
"jest": true,
"node": true
},

"plugins": [
"react"
"react",
"cypress",
"prettier"
],

"ecmaFeatures": {
"modules": true,
"jsx": true
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},

"parser": "babel-eslint",

"rules": {
"camelcase": [2, {"properties": "never"}],
"eqeqeq": 2,
"global-strict": 0,
"indent": [2, 2],
"jsx-quotes": [2, "prefer-double"],
"max-params": [2, 3],
"no-console": 0,
"no-shadow": 1,
"no-undef": 1,
"no-underscore-dangle": 0,
"no-use-before-define": 1,
"no-var": 2,
"quotes": [2, "single", "avoid-escape"],
"object-shorthand": [2, "always"],
"semi": 1,
"strict": [1, "function"],
"react/display-name": 0,
"react/jsx-no-undef": 1,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/no-did-mount-set-state": 1,
"react/no-did-update-set-state": 1,
"react/no-multi-comp": 1,
"react/no-unknown-property": 1,
"react/prop-types": 1,
"react/react-in-jsx-scope": 1,
"react/self-closing-comp": 1,
"react/wrap-multilines": 1
"camelcase": ["warn", {"properties": "never"}],
"curly": ["warn", "all"],
"eqeqeq": ["warn", "always"],
"max-params": ["warn", 3],
"no-shadow": "warn",
"no-undef": "warn",
"no-var": "warn",
"object-shorthand": ["error", "always"],
"react/jsx-no-undef": ["warn", { "allowGlobals": true }],
"react/no-multi-comp": ["warn", { "ignoreStateless": true }],
"react/react-in-jsx-scope": "warn",
"react/self-closing-comp": "warn",
"prettier/prettier": "error"
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
########## App ##########
/config/config.js
/dist/
/log/

Expand Down
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage
dist
node_modules
package.json
package-lock.json
51 changes: 51 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module.exports = function(api) {
const isTest = String(api.env()) === "test";

const plugins = [
"react-hot-loader/babel",

// stage 0
"@babel/plugin-proposal-function-bind",

// stage 1
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
["@babel/plugin-proposal-optional-chaining", { loose: false }],
["@babel/plugin-proposal-pipeline-operator", { proposal: "minimal" }],
["@babel/plugin-proposal-nullish-coalescing-operator", { loose: false }],
"@babel/plugin-proposal-do-expressions",

// stage 2
["@babel/plugin-proposal-decorators", { legacy: true }],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",

// stage 3
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
["@babel/plugin-proposal-class-properties", { loose: false }],
"@babel/plugin-proposal-json-strings",

// jest
isTest ? "babel-plugin-dynamic-import-node" : null
].filter(Boolean);

const presets = [
[
"@babel/preset-env",
{
debug: false,
modules: isTest ? "commonjs" : false,
useBuiltIns: "usage"
}
],
"@babel/preset-react"
];

return {
plugins,
presets
};
};
4 changes: 4 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"baseUrl": "http://localhost:3000/",
"integrationFolder": "cypress/e2e"
}
7 changes: 7 additions & 0 deletions cypress/e2e/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('app', () => {
it('can visit the app', () => {
cy.visit('/')
.getByText('Home')
.click()
})
})
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
5 changes: 5 additions & 0 deletions cypress/fixtures/profile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": 8739,
"name": "Jane",
"email": "jane@example.com"
}
Loading