diff --git a/.eslintrc b/.eslintrc index d971d1d8..b0c266c5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,5 @@ { - "extends": ["airbnb"], + "extends": ["airbnb", "prettier"], "globals": { "document": true, "window": true diff --git a/.vscode/settings.json b/.vscode/settings.json index 198dd38e..9ed71f92 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { + "prettier.eslintIntegration": true, "eslint.autoFixOnSave": true, "javascript.validate.enable": false, "editor.rulers": [ diff --git a/package-lock.json b/package-lock.json index dc529c05..67a94fcf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5026,9 +5026,9 @@ } }, "eslint-config-prettier": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-5.0.0.tgz", - "integrity": "sha512-c17Aqiz5e8LEqoc/QPmYnaxQFAHTx2KlCZBPxXXjEMmNchOLnV/7j0HoPZuC+rL/tDC9bazUYOKJW9bOhftI/w==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-4.3.0.tgz", + "integrity": "sha512-sZwhSTHVVz78+kYD3t5pCWSYEdVSBR0PXnwjDRsUs8ytIrK8PLXw+6FKp8r3Z7rx4ZszdetWlXYKOHoUrrwPlA==", "dev": true, "requires": { "get-stdin": "^6.0.0" diff --git a/package.json b/package.json index e03109df..6b60c6c9 100755 --- a/package.json +++ b/package.json @@ -17,14 +17,20 @@ "create-minor": "sh ./scripts/release minor", "create-patch": "sh ./scripts/release patch", "publish-release": "npm test && sh ./scripts/publish", - "lint": "eslint src" + "lint": "eslint src", + "format": "prettier --config .prettierrc.js --write \"src/**/*.{js,json,md}\" \"docs/**/*.{js,json,md}\" \"*.{js,json,md}\"" }, "husky": { "hooks": { "pre-commit": "lint-staged" } }, - "lint-staged": "npm run lint", + "lint-staged": { + "**/*.{js,css,md}": [ + "npm run format", + "git add" + ] + }, "repository": { "type": "git", "url": "git+https://github.com/video-react/video-react.git" @@ -103,6 +109,7 @@ "enzyme-adapter-react-16": "^1.14.0", "eslint": "^5.16.0", "eslint-config-airbnb": "^17.1.0", + "eslint-config-prettier": "^4.3.0", "eslint-plugin-import": "^2.17.3", "eslint-plugin-jsx-a11y": "^6.2.1", "eslint-plugin-react": "^7.13.0", @@ -116,6 +123,7 @@ "lint-staged": "^8.2.0", "mini-css-extract-plugin": "^0.5.0", "node-sass": "^4.12.0", + "prettier": "^1.18.2", "raw-loader": "^1.0.0", "react": "^16.8.6", "react-dom": "^16.8.6",