Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Commit

Permalink
feat(eslint): lint bad performance patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
epiqueras committed Nov 24, 2018
1 parent d18e7ee commit fca57e3
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 6 deletions.
14 changes: 13 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
// Plugins
plugins: ['unicorn'],
plugins: ['wyze', 'unicorn', 'react-perf'],

// Extends
extends: [
Expand Down Expand Up @@ -34,6 +34,11 @@ module.exports = {
{ blankLine: 'never', prev: 'import', next: 'import' }
],
'sort-keys': 2,
'no-useless-concat': 2,
'prefer-template': 2,

// wyze
'wyze/sort-destructuring-keys': 2,

// unicorn
'unicorn/no-fn-reference-in-iterator': 0, // Allows [].map(func)
Expand All @@ -59,6 +64,8 @@ module.exports = {
],
'react/jsx-no-bind': 2,
'react/jsx-indent': 0,
'react/jsx-sort-props': 2,
'react/jsx-curly-brace-presence': [2, 'never'],

// React
'react/prefer-stateless-function': 2,
Expand All @@ -69,6 +76,11 @@ module.exports = {
'react/require-default-props': 2,
'react/default-props-match-prop-types': 2,

// React Perf
'react-perf/jsx-no-new-object-as-prop': 2,
'react-perf/jsx-no-new-array-as-prop': 2,
'react-perf/jsx-no-new-function-as-prop': 2,

// JS Standard
'standard/computed-property-even-spacing': 0,
'jsx-a11y/href-no-hash': 0, // Buggy
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ process.on('unhandledRejection', err => {
const runCommitizen = require('commitizen/dist/cli/git-cz').bootstrap
const spawn = require('cross-spawn')

const { resolveInDir, resolveBin } = require('./resolve-utils')
const { resolveBin, resolveInDir } = require('./resolve-utils')

const flag = process.argv[3]
const CLICargs = process.argv.slice(flag === '--no-root' ? 4 : 3)
Expand Down Expand Up @@ -102,6 +102,6 @@ switch (scriptName) {
})
break
default:
console.log('Unknown script "' + scriptName + '".')
console.log(`Unknown script "${scriptName}".`)
process.exit(1)
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.6.1",
"eslint-plugin-react-perf": "^2.0.9",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-unicorn": "^6.0.1",
"eslint-plugin-wyze": "^3.4.0",
"lint-staged": "^8.0.4",
"prettier": "^1.13.7",
"solium": "^1.1.8",
Expand Down
2 changes: 1 addition & 1 deletion resolve-utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { resolve, join } = require('path')
const { join, resolve } = require('path')

const resolveInDir = filePath => resolve(__dirname, filePath)
const resolveBin = filePath =>
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/set-github-labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const fetch = require('isomorphic-fetch')

// Helper
const githubAPICaller = (path, { method = 'GET', body } = {}) =>
const githubAPICaller = (path, { body, method = 'GET' } = {}) =>
fetch(`https://api.github.com${encodeURI(path)}`, {
body: body && JSON.stringify(body),
headers: {
Expand Down
20 changes: 19 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ dir-glob@^2.0.0:
arrify "^1.0.1"
path-type "^3.0.0"

doctrine@1.5.0:
doctrine@1.5.0, doctrine@^1.2.2:
version "1.5.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa"
integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=
Expand Down Expand Up @@ -1753,6 +1753,14 @@ eslint-plugin-promise@^4.0.1:
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.0.1.tgz#2d074b653f35a23d1ba89d8e976a985117d1c6a2"
integrity sha512-Si16O0+Hqz1gDHsys6RtFRrW7cCTB6P7p3OJmKp3Y3dxpQE2qwOA7d3xnV+0mBmrPoi0RBnxlCKvqu70te6wjg==

eslint-plugin-react-perf@^2.0.9:
version "2.0.9"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-perf/-/eslint-plugin-react-perf-2.0.9.tgz#984982b1b6099fca68608ccb0ba5692ffbcf2fd8"
integrity sha512-znVvK7hZ+c7vR5aF4GjF0ki6usavJrPZ2OADylolNfFGA+iLYyNQogjFSRVKmyJ2R9IdZB3M+Ch5TtWoTOSBpw==
dependencies:
doctrine "^1.2.2"
jsx-ast-utils "^1.3.3"

eslint-plugin-react@^7.6.1:
version "7.11.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz#c01a7af6f17519457d6116aa94fc6d2ccad5443c"
Expand Down Expand Up @@ -1783,6 +1791,11 @@ eslint-plugin-unicorn@^6.0.1:
lodash.upperfirst "^4.2.0"
safe-regex "^1.1.0"

eslint-plugin-wyze@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-wyze/-/eslint-plugin-wyze-3.4.0.tgz#9c7219b5c6a09b6061ed820c518564ec04b085fc"
integrity sha1-nHIZtcagm2Bh7YIMUYVk7ASwhfw=

eslint-scope@3.7.1:
version "3.7.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
Expand Down Expand Up @@ -3224,6 +3237,11 @@ jsonparse@^1.2.0:
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=

jsx-ast-utils@^1.3.3:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1"
integrity sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=

jsx-ast-utils@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f"
Expand Down

0 comments on commit fca57e3

Please sign in to comment.