├── .babelrc ├── .editorconfig ├── .eslintrc.js ├── .flowconfig ├── .gitignore ├── .npmignore ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── __test-helpers__ ├── allProps.js ├── configureStore.js ├── createApp.js └── styles.css ├── __tests__ ├── __snapshots__ │ └── components.js.snap ├── components.js └── dom-utils.js ├── package.json ├── src ├── Transition.js ├── TransitionGroup.js ├── dom-utils.js └── index.js ├── storybook ├── .babelrc ├── addons.js └── config.js ├── wallaby.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "react", "stage-0"], 3 | "plugins": ["flow-react-proptypes", "transform-flow-strip-types"] 4 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | [*] 3 | indent_style = space 4 | indent_size = 2 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | [*.md] 10 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "browser": true, 4 | "commonjs": true, 5 | "es6": true 6 | }, 7 | "extends": [ 8 | "plugin:flowtype/recommended" 9 | ], 10 | "parser": "babel-eslint", 11 | "parserOptions": { 12 | "ecmaFeatures": { 13 | "generators": true, 14 | "experimentalObjectRestSpread": true, 15 | "jsx": true 16 | }, 17 | "sourceType": "module", 18 | "allowImportExportEverywhere": false 19 | }, 20 | "plugins": [ 21 | "react", 22 | "babel", 23 | "flowtype", 24 | "import" 25 | ], 26 | "globals": { 27 | "window": true, 28 | "document": true, 29 | "__dirname": true, 30 | "__DEV__": true, 31 | "CONFIG": true, 32 | "process": true, 33 | "jest": true, 34 | "describe": true, 35 | "it": true, 36 | "expect": true, 37 | "beforeEach": true, 38 | "afterEach": true, 39 | "beforeAll": true, 40 | "afterAll": true, 41 | "jasmine": true, 42 | "storybook":true, 43 | }, 44 | "settings": { 45 | "flowtype": { 46 | "onlyFilesWithFlowAnnotation": true 47 | }, 48 | 'import/resolver': { 49 | node: { 50 | extensions: ['.js', '.json', '.styl', '.css'] 51 | } 52 | }, 53 | 'import/extensions': [ 54 | '.js', 55 | '.css', 56 | ], 57 | 'import/core-modules': [ 58 | ], 59 | 'import/ignore': [ 60 | 'node_modules', 61 | 'flow-typed', 62 | '\\.(css|styl|svg|json)$', 63 | ], 64 | }, 65 | "rules": { 66 | "flowtype/boolean-style": [ 67 | 2, 68 | "boolean" 69 | ], 70 | "flowtype/define-flow-type": 1, 71 | "flowtype/delimiter-dangle": [ 72 | 2, 73 | "always-multiline" 74 | ], 75 | "flowtype/generic-spacing": [ 76 | 2, 77 | "never" 78 | ], 79 | "flowtype/no-primitive-constructor-types": 2, 80 | "flowtype/no-weak-types": 0, 81 | "flowtype/object-type-delimiter": [ 82 | 2, 83 | "comma" 84 | ], 85 | "flowtype/require-parameter-type": [ 86 | 2, 87 | { 88 | "excludeArrowFunctions": true 89 | } 90 | ], 91 | "flowtype/require-return-type": [ 92 | 2, 93 | "never", 94 | { 95 | "annotateUndefined": "never" 96 | } 97 | ], 98 | "flowtype/require-valid-file-annotation": [ 99 | 2, 100 | "never" 101 | ], 102 | "flowtype/semi": [ 103 | 2, 104 | "never" 105 | ], 106 | "flowtype/space-after-type-colon": [ 107 | 2, 108 | "always" 109 | ], 110 | "flowtype/space-before-generic-bracket": [ 111 | 2, 112 | "never" 113 | ], 114 | "flowtype/space-before-type-colon": [ 115 | 2, 116 | "never" 117 | ], 118 | "flowtype/type-id-match": [ 119 | 2, 120 | "^([A-Z][a-z0-9]+)+$" 121 | ], 122 | "flowtype/union-intersection-spacing": [ 123 | 2, 124 | "always" 125 | ], 126 | "flowtype/use-flow-type": 1, 127 | "flowtype/valid-syntax": 1, 128 | "react/no-comment-textnodes": 0, 129 | "no-debugger": 1, 130 | "generator-star-spacing": 1, 131 | "babel/new-cap": 1, 132 | "array-bracket-spacing": 0, 133 | "babel/object-curly-spacing": 0, 134 | "object-shorthand": 1, 135 | "arrow-parens": 0, 136 | "babel/no-await-in-loop": 1, 137 | "comma-dangle": 0, 138 | "no-console": ["off", { allow: ["warn", "error"] }], 139 | "no-unused-vars": ["off", { "vars": "all", "args": "after-used" }], //doesn't play nice with jsx 140 | "strict": 0, 141 | "indent": [ 142 | "warn", 143 | 2 144 | ], 145 | "linebreak-style": [ 146 | "error", 147 | "unix" 148 | ], 149 | "quotes": [ 150 | "error", 151 | "single" 152 | ], 153 | 154 | 155 | 156 | // AIRBNB REACT: 157 | // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/rules/react.js 158 | 159 | // Specify whether double or single quotes should be used in JSX attributes 160 | // http://eslint.org/docs/rules/jsx-quotes 161 | 'jsx-quotes': ['error', 'prefer-single'], 162 | 163 | // Prevent missing displayName in a React component definition 164 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md 165 | 'react/display-name': ['off', { ignoreTranspilerName: false }], 166 | 167 | // Forbid certain propTypes (any, array, object) 168 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md 169 | 'react/forbid-prop-types': ['error', { forbid: ['any', 'array', 'object'] }], 170 | 171 | // Enforce boolean attributes notation in JSX 172 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md 173 | 'react/jsx-boolean-value': ['error', 'always'], 174 | 175 | // Validate closing bracket location in JSX 176 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md 177 | 'react/jsx-closing-bracket-location': ['error', 'line-aligned'], 178 | 179 | // Enforce or disallow spaces inside of curly braces in JSX attributes 180 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md 181 | 'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }], 182 | 183 | // Enforce event handler naming conventions in JSX 184 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md 185 | 'react/jsx-handler-names': ['off', { 186 | eventHandlerPrefix: 'handle', 187 | eventHandlerPropPrefix: 'on', 188 | }], 189 | 190 | // Validate props indentation in JSX 191 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md 192 | 'react/jsx-indent-props': ['error', 2], 193 | 194 | // Validate JSX has key prop when in array or iterator 195 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md 196 | 'react/jsx-key': 'off', 197 | 198 | // Limit maximum of props on a single line in JSX 199 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md 200 | 'react/jsx-max-props-per-line': ['off', { maximum: 1 }], 201 | 202 | // Prevent usage of .bind() in JSX props 203 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md 204 | 'react/jsx-no-bind': ['error', { 205 | ignoreRefs: true, 206 | allowArrowFunctions: true, 207 | allowBind: false, 208 | }], 209 | 210 | // Prevent duplicate props in JSX 211 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md 212 | 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }], 213 | 214 | // Prevent usage of unwrapped JSX strings 215 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md 216 | 'react/jsx-no-literals': 'off', 217 | 218 | // Disallow undeclared variables in JSX 219 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md 220 | 'react/jsx-no-undef': 'error', 221 | 222 | // Enforce PascalCase for user-defined JSX components 223 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md 224 | 'react/jsx-pascal-case': ['error', { 225 | allowAllCaps: true, 226 | ignore: [], 227 | }], 228 | 229 | // Enforce propTypes declarations alphabetical sorting 230 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md 231 | 'react/sort-prop-types': ['off', { 232 | ignoreCase: true, 233 | callbacksLast: false, 234 | requiredFirst: false, 235 | }], 236 | 237 | // Deprecated in favor of react/jsx-sort-props 238 | 'react/jsx-sort-prop-types': 'off', 239 | 240 | // Enforce props alphabetical sorting 241 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md 242 | 'react/jsx-sort-props': ['off', { 243 | ignoreCase: true, 244 | callbacksLast: false, 245 | shorthandFirst: false, 246 | shorthandLast: false, 247 | }], 248 | 249 | // Prevent React to be incorrectly marked as unused 250 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md 251 | 'react/jsx-uses-react': ['error'], 252 | 253 | // Prevent variables used in JSX to be incorrectly marked as unused 254 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md 255 | 'react/jsx-uses-vars': 'error', 256 | 257 | // Prevent usage of dangerous JSX properties 258 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md 259 | 'react/no-danger': 'warn', 260 | 261 | // Prevent usage of deprecated methods 262 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md 263 | 'react/no-deprecated': ['error'], 264 | 265 | // Prevent usage of setState in componentDidMount 266 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md 267 | 'react/no-did-mount-set-state': ['error'], 268 | 269 | // Prevent usage of setState in componentDidUpdate 270 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md 271 | 'react/no-did-update-set-state': ['error'], 272 | 273 | // Prevent direct mutation of this.state 274 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md 275 | 'react/no-direct-mutation-state': 'off', 276 | 277 | // Prevent usage of isMounted 278 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md 279 | 'react/no-is-mounted': 'error', 280 | 281 | // Prevent multiple component definition per file 282 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md 283 | 'react/no-multi-comp': ['error', { ignoreStateless: true }], 284 | 285 | // Prevent usage of setState 286 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md 287 | 'react/no-set-state': 'off', 288 | 289 | // Prevent using string references 290 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md 291 | 'react/no-string-refs': 'error', 292 | 293 | // Prevent usage of unknown DOM property 294 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md 295 | 'react/no-unknown-property': 'error', 296 | 297 | // Require ES6 class declarations over React.createClass 298 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md 299 | 'react/prefer-es6-class': ['error', 'always'], 300 | 301 | // Require stateless functions when not using lifecycle methods, setState or ref 302 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md 303 | 'react/prefer-stateless-function': 'error', 304 | 305 | // Prevent missing props validation in a React component definition 306 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md 307 | 'react/prop-types': [0, { ignore: ['data-hover'], customValidators: [] }], 308 | 309 | // Prevent missing React when using JSX 310 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md 311 | 'react/react-in-jsx-scope': 'error', 312 | 313 | // Restrict file extensions that may be required 314 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-extension.md 315 | // deprecated in favor of import/extensions 316 | 'react/require-extension': ['off', { extensions: ['.jsx', '.js'] }], 317 | 318 | // Require render() methods to return something 319 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md 320 | 'react/require-render-return': 'error', 321 | 322 | // Prevent extra closing tags for components without children 323 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md 324 | 'react/self-closing-comp': 'error', 325 | 326 | // Enforce spaces before the closing bracket of self-closing JSX elements 327 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md 328 | 'react/jsx-space-before-closing': ['error', 'always'], 329 | 330 | // Enforce component methods order 331 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md 332 | 'react/sort-comp': [1, { 333 | order: [ 334 | 'props', 335 | 'state', 336 | 'static-methods', 337 | 'lifecycle', 338 | '/^on.+$/', 339 | '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', 340 | 'everything-else', 341 | '/^render.+$/', 342 | 'render' 343 | ], 344 | }], 345 | 346 | // Prevent missing parentheses around multilines JSX 347 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md 348 | 'react/jsx-wrap-multilines': [0, { 349 | declaration: true, 350 | assignment: true, 351 | return: true 352 | }], 353 | 'react/wrap-multilines': 'off', // deprecated version 354 | 355 | // Require that the first prop in a JSX element be on a new line when the element is multiline 356 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md 357 | 'react/jsx-first-prop-new-line': ['error', 'multiline'], 358 | 359 | // Enforce spacing around jsx equals signs 360 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md 361 | 'react/jsx-equals-spacing': ['error', 'never'], 362 | 363 | // Enforce JSX indentation 364 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md 365 | 'react/jsx-indent': ['error', 2], 366 | 367 | // Disallow target="_blank" on links 368 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md 369 | // NOTE: WE MAY WANT TO BRING THIS BACK, BUT WE NEED TO MAKE our pure-redux-router-link library have: rel='noopener noreferrer' 370 | 'react/jsx-no-target-blank': 0, 371 | 372 | // only .jsx files may have JSX 373 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md 374 | 'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.js'] }], 375 | 376 | // prevent accidental JS comments from being injected into JSX as text 377 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md 378 | 'react/jsx-no-comment-textnodes': 'error', 379 | 'react/no-comment-textnodes': 'off', // deprecated version 380 | 381 | // disallow using React.render/ReactDOM.render's return value 382 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md 383 | 'react/no-render-return-value': 'error', 384 | 385 | // require a shouldComponentUpdate method, or PureRenderMixin 386 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md 387 | 'react/require-optimization': ['off', { allowDecorators: [] }], 388 | 389 | // warn against using findDOMNode() 390 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md 391 | 'react/no-find-dom-node': 0, 392 | 393 | // Forbid certain props on Components 394 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md 395 | 'react/forbid-component-props': ['off', { forbid: [] }], 396 | 397 | // Prevent problem with children and props.dangerouslySetInnerHTML 398 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md 399 | 'react/no-danger-with-children': 'error', 400 | 401 | // Prevent unused propType definitions 402 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md 403 | 'react/no-unused-prop-types': ['error', { 404 | customValidators: [ 405 | ], 406 | skipShapeProps: true, 407 | }], 408 | 409 | // Require style prop value be an object or var 410 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md 411 | 'react/style-prop-object': 'error', 412 | 413 | // Prevent invalid characters from appearing in markup 414 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md 415 | 'react/no-unescaped-entities': 'error', 416 | 417 | // Prevent passing of children as props 418 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md 419 | 'react/no-children-prop': 'error', 420 | 421 | // Validate whitespace in and around the JSX opening and closing brackets 422 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md 423 | 'react/jsx-tag-spacing': ['error', { 424 | closingSlash: 'never', 425 | beforeSelfClosing: 'always', 426 | afterOpening: 'never' 427 | }], 428 | 429 | // Prevent usage of Array index in keys 430 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md 431 | 'react/no-array-index-key': 'error', 432 | 433 | // Enforce a defaultProps definition for every prop that is not a required prop 434 | // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-default-props.md 435 | 'react/require-default-props': 0, 436 | 437 | 438 | 439 | 440 | // AIRBNB ERRORS: 441 | // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js 442 | 443 | // require trailing commas in multiline object literals 444 | 'comma-dangle': ['error', { 445 | arrays: 'always-multiline', 446 | objects: 'always-multiline', 447 | imports: 'always-multiline', 448 | exports: 'always-multiline', 449 | functions: 'always-multiline', 450 | }], 451 | 452 | // Disallow await inside of loops 453 | // http://eslint.org/docs/rules/no-await-in-loop 454 | 'no-await-in-loop': 'error', 455 | 456 | // disallow assignment in conditional expressions 457 | 'no-cond-assign': ['error', 'always'], 458 | 459 | // disallow use of console 460 | 'no-console': ["off", { allow: ["warn", "error"] }], 461 | 462 | // disallow use of constant expressions in conditions 463 | 'no-constant-condition': 'warn', 464 | 465 | // disallow control characters in regular expressions 466 | 'no-control-regex': 'error', 467 | 468 | // disallow use of debugger 469 | 'no-debugger': 'error', 470 | 471 | // disallow duplicate arguments in functions 472 | 'no-dupe-args': 'error', 473 | 474 | // disallow duplicate keys when creating object literals 475 | 'no-dupe-keys': 'error', 476 | 477 | // disallow a duplicate case label. 478 | 'no-duplicate-case': 'error', 479 | 480 | // disallow empty statements 481 | 'no-empty': 'error', 482 | 483 | // disallow the use of empty character classes in regular expressions 484 | 'no-empty-character-class': 'error', 485 | 486 | // disallow assigning to the exception in a catch block 487 | 'no-ex-assign': 'error', 488 | 489 | // disallow double-negation boolean casts in a boolean context 490 | // http://eslint.org/docs/rules/no-extra-boolean-cast 491 | 'no-extra-boolean-cast': 'error', 492 | 493 | // disallow unnecessary parentheses 494 | // http://eslint.org/docs/rules/no-extra-parens 495 | 'no-extra-parens': ['off', 'all', { 496 | conditionalAssign: true, 497 | nestedBinaryExpressions: false, 498 | returnAssign: false, 499 | }], 500 | 501 | // disallow unnecessary semicolons 502 | 'no-extra-semi': 'error', 503 | 504 | // disallow overwriting functions written as function declarations 505 | 'no-func-assign': 'error', 506 | 507 | // disallow function or variable declarations in nested blocks 508 | 'no-inner-declarations': 'error', 509 | 510 | // disallow invalid regular expression strings in the RegExp constructor 511 | 'no-invalid-regexp': 'error', 512 | 513 | // disallow irregular whitespace outside of strings and comments 514 | 'no-irregular-whitespace': 'error', 515 | 516 | // disallow the use of object properties of the global object (Math and JSON) as functions 517 | 'no-obj-calls': 'error', 518 | 519 | // disallow use of Object.prototypes builtins directly 520 | // http://eslint.org/docs/rules/no-prototype-builtins 521 | 'no-prototype-builtins': 'error', 522 | 523 | // disallow multiple spaces in a regular expression literal 524 | 'no-regex-spaces': 'error', 525 | 526 | // disallow sparse arrays 527 | 'no-sparse-arrays': 'error', 528 | 529 | // Disallow template literal placeholder syntax in regular strings 530 | // http://eslint.org/docs/rules/no-template-curly-in-string 531 | 'no-template-curly-in-string': 'error', 532 | 533 | // Avoid code that looks like two expressions but is actually one 534 | // http://eslint.org/docs/rules/no-unexpected-multiline 535 | 'no-unexpected-multiline': 'error', 536 | 537 | // disallow unreachable statements after a return, throw, continue, or break statement 538 | 'no-unreachable': 'error', 539 | 540 | // disallow return/throw/break/continue inside finally blocks 541 | // http://eslint.org/docs/rules/no-unsafe-finally 542 | 'no-unsafe-finally': 'error', 543 | 544 | // disallow negating the left operand of relational operators 545 | // http://eslint.org/docs/rules/no-unsafe-negation 546 | 'no-unsafe-negation': 'error', 547 | // disallow negation of the left operand of an in expression 548 | // deprecated in favor of no-unsafe-negation 549 | 'no-negated-in-lhs': 'off', 550 | 551 | // disallow comparisons with the value NaN 552 | 'use-isnan': 'error', 553 | 554 | // ensure JSDoc comments are valid 555 | // http://eslint.org/docs/rules/valid-jsdoc 556 | 'valid-jsdoc': 'off', 557 | 558 | // ensure that the results of typeof are compared against a valid string 559 | // http://eslint.org/docs/rules/valid-typeof 560 | 'valid-typeof': ['error', { requireStringLiterals: true }], 561 | 562 | 563 | 564 | // AIRBNB VARIABLES 565 | // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js 566 | 567 | // enforce or disallow variable initializations at definition 568 | 'init-declarations': 'off', 569 | 570 | // disallow the catch clause parameter name being the same as a variable in the outer scope 571 | 'no-catch-shadow': 'off', 572 | 573 | // disallow deletion of variables 574 | 'no-delete-var': 'error', 575 | 576 | // disallow labels that share a name with a variable 577 | // http://eslint.org/docs/rules/no-label-var 578 | 'no-label-var': 'error', 579 | 580 | // disallow specific globals 581 | 'no-restricted-globals': 'off', 582 | 583 | // disallow declaration of variables already declared in the outer scope 584 | 'no-shadow': [0, { "builtinGlobals": false, "hoist": "functions", "allow": [] }], 585 | 586 | // disallow shadowing of names such as arguments 587 | 'no-shadow-restricted-names': 'error', 588 | 589 | // disallow use of undeclared variables unless mentioned in a /*global */ block 590 | 'no-undef': 'error', 591 | 592 | // disallow use of undefined when initializing variables 593 | 'no-undef-init': 'error', 594 | 595 | // disallow use of undefined variable 596 | // http://eslint.org/docs/rules/no-undefined 597 | // TODO: enable? 598 | 'no-undefined': 'off', 599 | 600 | // disallow declaration of variables that are not used in the code 601 | 'no-unused-vars': ['error', { vars: 'local', args: 'after-used' }], 602 | 603 | // disallow use of variables before they are defined 604 | 'no-use-before-define': 0, 605 | 606 | 607 | 608 | 609 | // AIRBNB BEST-PRACTICES: 610 | // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js 611 | 612 | // enforces getter/setter pairs in objects 613 | 'accessor-pairs': 'off', 614 | 615 | // enforces return statements in callbacks of array's methods 616 | // http://eslint.org/docs/rules/array-callback-return 617 | 'array-callback-return': 'error', 618 | 619 | // treat var statements as if they were block scoped 620 | 'block-scoped-var': 'error', 621 | 622 | // specify the maximum cyclomatic complexity allowed in a program 623 | complexity: ['off', 11], 624 | 625 | // enforce that class methods use "this" 626 | // http://eslint.org/docs/rules/class-methods-use-this 627 | 'class-methods-use-this': ['error', { 628 | exceptMethods: [], 629 | }], 630 | 631 | // require return statements to either always or never specify values 632 | 'consistent-return': 'error', 633 | 634 | // specify curly brace conventions for all control statements 635 | curly: ['error', 'multi-line'], 636 | 637 | // require default case in switch statements 638 | 'default-case': ['error', { commentPattern: '^no default$' }], 639 | 640 | // encourages use of dot notation whenever possible 641 | 'dot-notation': ['error', { allowKeywords: true }], 642 | 643 | // enforces consistent newlines before or after dots 644 | // http://eslint.org/docs/rules/dot-location 645 | 'dot-location': ['error', 'property'], 646 | 647 | // require the use of === and !== 648 | // http://eslint.org/docs/rules/eqeqeq 649 | eqeqeq: ['error', 'always', { null: 'ignore' }], 650 | 651 | // make sure for-in loops have an if statement 652 | 'guard-for-in': 'error', 653 | 654 | // disallow the use of alert, confirm, and prompt 655 | 'no-alert': 0, 656 | 657 | // disallow use of arguments.caller or arguments.callee 658 | 'no-caller': 'error', 659 | 660 | // disallow lexical declarations in case/default clauses 661 | // http://eslint.org/docs/rules/no-case-declarations.html 662 | 'no-case-declarations': 'error', 663 | 664 | // disallow division operators explicitly at beginning of regular expression 665 | // http://eslint.org/docs/rules/no-div-regex 666 | 'no-div-regex': 'off', 667 | 668 | // disallow else after a return in an if 669 | 'no-else-return': 'error', 670 | 671 | // disallow empty functions, except for standalone funcs/arrows 672 | // http://eslint.org/docs/rules/no-empty-function 673 | 'no-empty-function': ['error', { 674 | allow: [ 675 | 'arrowFunctions', 676 | 'functions', 677 | 'methods', 678 | ] 679 | }], 680 | 681 | // disallow empty destructuring patterns 682 | // http://eslint.org/docs/rules/no-empty-pattern 683 | 'no-empty-pattern': 'error', 684 | 685 | // disallow comparisons to null without a type-checking operator 686 | 'no-eq-null': 'off', 687 | 688 | // disallow use of eval() 689 | 'no-eval': 'error', 690 | 691 | // disallow adding to native types 692 | 'no-extend-native': 'error', 693 | 694 | // disallow unnecessary function binding 695 | 'no-extra-bind': 'error', 696 | 697 | // disallow Unnecessary Labels 698 | // http://eslint.org/docs/rules/no-extra-label 699 | 'no-extra-label': 'error', 700 | 701 | // disallow fallthrough of case statements 702 | 'no-fallthrough': 'error', 703 | 704 | // disallow the use of leading or trailing decimal points in numeric literals 705 | 'no-floating-decimal': 'error', 706 | 707 | // disallow reassignments of native objects or read-only globals 708 | // http://eslint.org/docs/rules/no-global-assign 709 | 'no-global-assign': ['error', { exceptions: [] }], 710 | // deprecated in favor of no-global-assign 711 | 'no-native-reassign': 'off', 712 | 713 | // disallow implicit type conversions 714 | // http://eslint.org/docs/rules/no-implicit-coercion 715 | 'no-implicit-coercion': ['off', { 716 | boolean: false, 717 | number: true, 718 | string: true, 719 | allow: [], 720 | }], 721 | 722 | // disallow var and named functions in global scope 723 | // http://eslint.org/docs/rules/no-implicit-globals 724 | 'no-implicit-globals': 'off', 725 | 726 | // disallow use of eval()-like methods 727 | 'no-implied-eval': 'error', 728 | 729 | // disallow this keywords outside of classes or class-like objects 730 | 'no-invalid-this': 'off', 731 | 732 | // disallow usage of __iterator__ property 733 | 'no-iterator': 'error', 734 | 735 | // disallow use of labels for anything other then loops and switches 736 | 'no-labels': ['error', { allowLoop: false, allowSwitch: false }], 737 | 738 | // disallow unnecessary nested blocks 739 | 'no-lone-blocks': 'error', 740 | 741 | // disallow creation of functions within loops 742 | 'no-loop-func': 'error', 743 | 744 | // disallow magic numbers 745 | // http://eslint.org/docs/rules/no-magic-numbers 746 | 'no-magic-numbers': ['off', { 747 | ignore: [], 748 | ignoreArrayIndexes: true, 749 | enforceConst: true, 750 | detectObjects: false, 751 | }], 752 | 753 | // disallow use of multiple spaces 754 | 'no-multi-spaces': 'error', 755 | 756 | // disallow use of multiline strings 757 | 'no-multi-str': 'error', 758 | 759 | // disallow use of new operator when not part of the assignment or comparison 760 | 'no-new': 'error', 761 | 762 | // disallow use of new operator for Function object 763 | 'no-new-func': 'error', 764 | 765 | // disallows creating new instances of String, Number, and Boolean 766 | 'no-new-wrappers': 'error', 767 | 768 | // disallow use of (old style) octal literals 769 | 'no-octal': 'error', 770 | 771 | // disallow use of octal escape sequences in string literals, such as 772 | // var foo = 'Copyright \251'; 773 | 'no-octal-escape': 'error', 774 | 775 | // disallow reassignment of function parameters 776 | // disallow parameter object manipulation 777 | // rule: http://eslint.org/docs/rules/no-param-reassign.html 778 | 'no-param-reassign': 0, 779 | 780 | // disallow usage of __proto__ property 781 | 'no-proto': 'error', 782 | 783 | // disallow declaring the same variable more then once 784 | 'no-redeclare': 'error', 785 | 786 | // disallow certain object properties 787 | // http://eslint.org/docs/rules/no-restricted-properties 788 | 'no-restricted-properties': ['error', { 789 | object: 'arguments', 790 | property: 'callee', 791 | message: 'arguments.callee is deprecated', 792 | }, { 793 | property: '__defineGetter__', 794 | message: 'Please use Object.defineProperty instead.', 795 | }, { 796 | property: '__defineSetter__', 797 | message: 'Please use Object.defineProperty instead.', 798 | }, { 799 | object: 'Math', 800 | property: 'pow', 801 | message: 'Use the exponentiation operator (**) instead.', 802 | }], 803 | 804 | // disallow use of assignment in return statement 805 | 'no-return-assign': 0, 806 | 807 | // disallow redundant `return await` 808 | 'no-return-await': 'error', 809 | 810 | // disallow use of `javascript:` urls. 811 | 'no-script-url': 'error', 812 | 813 | // disallow self assignment 814 | // http://eslint.org/docs/rules/no-self-assign 815 | 'no-self-assign': 'error', 816 | 817 | // disallow comparisons where both sides are exactly the same 818 | 'no-self-compare': 'error', 819 | 820 | // disallow use of comma operator 821 | 'no-sequences': 'error', 822 | 823 | // restrict what can be thrown as an exception 824 | 'no-throw-literal': 'error', 825 | 826 | // disallow unmodified conditions of loops 827 | // http://eslint.org/docs/rules/no-unmodified-loop-condition 828 | 'no-unmodified-loop-condition': 'off', 829 | 830 | // disallow usage of expressions in statement position 831 | 'no-unused-expressions': ['error', { 832 | allowShortCircuit: false, 833 | allowTernary: false, 834 | }], 835 | 836 | // disallow unused labels 837 | // http://eslint.org/docs/rules/no-unused-labels 838 | 'no-unused-labels': 'error', 839 | 840 | // disallow unnecessary .call() and .apply() 841 | 'no-useless-call': 'off', 842 | 843 | // disallow useless string concatenation 844 | // http://eslint.org/docs/rules/no-useless-concat 845 | 'no-useless-concat': 'error', 846 | 847 | // disallow unnecessary string escaping 848 | // http://eslint.org/docs/rules/no-useless-escape 849 | 'no-useless-escape': 'error', 850 | 851 | // disallow redundant return; keywords 852 | // http://eslint.org/docs/rules/no-useless-return 853 | 'no-useless-return': 'error', 854 | 855 | // disallow use of void operator 856 | // http://eslint.org/docs/rules/no-void 857 | 'no-void': 'error', 858 | 859 | // disallow usage of configurable warning terms in comments: e.g. todo 860 | 'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }], 861 | 862 | // disallow use of the with statement 863 | 'no-with': 'error', 864 | 865 | // require use of the second argument for parseInt() 866 | radix: 0, 867 | 868 | // require `await` in `async function` (note: this is a horrible rule that should never be used) 869 | // http://eslint.org/docs/rules/require-await 870 | 'require-await': 'off', 871 | 872 | // requires to declare all vars on top of their containing scope 873 | 'vars-on-top': 'error', 874 | 875 | // require immediate function invocation to be wrapped in parentheses 876 | // http://eslint.org/docs/rules/wrap-iife.html 877 | 'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }], 878 | 879 | // require or disallow Yoda conditions 880 | yoda: 'error', 881 | 882 | 883 | 884 | // AIRBNB ES6: 885 | // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/es6.js 886 | 887 | // enforces no braces where they can be omitted 888 | // http://eslint.org/docs/rules/arrow-body-style 889 | // TODO: enable requireReturnForObjectLiteral? 890 | 'arrow-body-style': ['error', 'as-needed', { 891 | requireReturnForObjectLiteral: false, 892 | }], 893 | 894 | // require parens in arrow function arguments 895 | // http://eslint.org/docs/rules/arrow-parens 896 | 'arrow-parens': ['error', 'as-needed', { 897 | requireForBlockBody: true, 898 | }], 899 | 900 | // require space before/after arrow function's arrow 901 | // http://eslint.org/docs/rules/arrow-spacing 902 | 'arrow-spacing': ['error', { before: true, after: true }], 903 | 904 | // verify super() callings in constructors 905 | 'constructor-super': 'error', 906 | 907 | // enforce the spacing around the * in generator functions 908 | // http://eslint.org/docs/rules/generator-star-spacing 909 | 'generator-star-spacing': ['error', { before: false, after: true }], 910 | 911 | // disallow modifying variables of class declarations 912 | // http://eslint.org/docs/rules/no-class-assign 913 | 'no-class-assign': 'error', 914 | 915 | // disallow arrow functions where they could be confused with comparisons 916 | // http://eslint.org/docs/rules/no-confusing-arrow 917 | 'no-confusing-arrow': 0, 918 | 919 | // disallow modifying variables that are declared using const 920 | 'no-const-assign': 'error', 921 | 922 | // disallow duplicate class members 923 | // http://eslint.org/docs/rules/no-dupe-class-members 924 | 'no-dupe-class-members': 'error', 925 | 926 | // disallow importing from the same path more than once 927 | // http://eslint.org/docs/rules/no-duplicate-imports 928 | // replaced by https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md 929 | 'no-duplicate-imports': 'off', 930 | 931 | // disallow symbol constructor 932 | // http://eslint.org/docs/rules/no-new-symbol 933 | 'no-new-symbol': 'error', 934 | 935 | // disallow specific imports 936 | // http://eslint.org/docs/rules/no-restricted-imports 937 | 'no-restricted-imports': 'off', 938 | 939 | // disallow to use this/super before super() calling in constructors. 940 | // http://eslint.org/docs/rules/no-this-before-super 941 | 'no-this-before-super': 'error', 942 | 943 | // disallow useless computed property keys 944 | // http://eslint.org/docs/rules/no-useless-computed-key 945 | 'no-useless-computed-key': 'error', 946 | 947 | // disallow unnecessary constructor 948 | // http://eslint.org/docs/rules/no-useless-constructor 949 | 'no-useless-constructor': 'error', 950 | 951 | // disallow renaming import, export, and destructured assignments to the same name 952 | // http://eslint.org/docs/rules/no-useless-rename 953 | 'no-useless-rename': ['error', { 954 | ignoreDestructuring: false, 955 | ignoreImport: false, 956 | ignoreExport: false, 957 | }], 958 | 959 | // require let or const instead of var 960 | 'no-var': 'error', 961 | 962 | // require method and property shorthand syntax for object literals 963 | // http://eslint.org/docs/rules/object-shorthand 964 | 'object-shorthand': ['error', 'always', { 965 | ignoreConstructors: false, 966 | avoidQuotes: true, 967 | }], 968 | 969 | // suggest using arrow functions as callbacks 970 | 'prefer-arrow-callback': ['error', { 971 | allowNamedFunctions: false, 972 | allowUnboundThis: true, 973 | }], 974 | 975 | // suggest using of const declaration for variables that are never modified after declared 976 | 'prefer-const': ['error', { 977 | destructuring: 'any', 978 | ignoreReadBeforeAssign: true, 979 | }], 980 | 981 | // Prefer destructuring from arrays and objects 982 | // http://eslint.org/docs/rules/prefer-destructuring 983 | // TODO: enable 984 | 'prefer-destructuring': ['off', { 985 | array: true, 986 | object: true, 987 | }, { 988 | enforceForRenamedProperties: false, 989 | }], 990 | 991 | // disallow parseInt() in favor of binary, octal, and hexadecimal literals 992 | // http://eslint.org/docs/rules/prefer-numeric-literals 993 | 'prefer-numeric-literals': 'error', 994 | 995 | // suggest using Reflect methods where applicable 996 | // http://eslint.org/docs/rules/prefer-reflect 997 | // TODO: enable? 998 | 'prefer-reflect': 'off', 999 | 1000 | // use rest parameters instead of arguments 1001 | // http://eslint.org/docs/rules/prefer-rest-params 1002 | 'prefer-rest-params': 'error', 1003 | 1004 | // suggest using the spread operator instead of .apply() 1005 | // http://eslint.org/docs/rules/prefer-spread 1006 | 'prefer-spread': 'error', 1007 | 1008 | // suggest using template literals instead of string concatenation 1009 | // http://eslint.org/docs/rules/prefer-template 1010 | 'prefer-template': 'error', 1011 | 1012 | // disallow generator functions that do not have yield 1013 | // http://eslint.org/docs/rules/require-yield 1014 | 'require-yield': 'error', 1015 | 1016 | // enforce spacing between object rest-spread 1017 | // http://eslint.org/docs/rules/rest-spread-spacing 1018 | 'rest-spread-spacing': ['error', 'never'], 1019 | 1020 | // import sorting 1021 | // http://eslint.org/docs/rules/sort-imports 1022 | 'sort-imports': ['off', { 1023 | ignoreCase: false, 1024 | ignoreMemberSort: false, 1025 | memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], 1026 | }], 1027 | 1028 | // require a Symbol description 1029 | // http://eslint.org/docs/rules/symbol-description 1030 | 'symbol-description': 'error', 1031 | 1032 | // enforce usage of spacing in template strings 1033 | // http://eslint.org/docs/rules/template-curly-spacing 1034 | 'template-curly-spacing': 'error', 1035 | 1036 | // enforce spacing around the * in yield* expressions 1037 | // http://eslint.org/docs/rules/yield-star-spacing 1038 | 'yield-star-spacing': ['error', 'after'], 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | // AIRBNB IMPORTS: 1045 | // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js 1046 | 1047 | // ensure imports point to files/modules that can be resolved 1048 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md 1049 | 'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }], 1050 | 1051 | // ensure named imports coupled with named exports 1052 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it 1053 | 'import/named': 'off', 1054 | 1055 | // ensure default import coupled with default export 1056 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it 1057 | 'import/default': 'off', 1058 | 1059 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md 1060 | 'import/namespace': 'off', 1061 | 1062 | // Helpful warnings: 1063 | 1064 | // disallow invalid exports, e.g. multiple defaults 1065 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md 1066 | 'import/export': 'error', 1067 | 1068 | // do not allow a default import name to match a named export 1069 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md 1070 | 'import/no-named-as-default': 0, 1071 | 1072 | // warn on accessing default export property names that are also named exports 1073 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md 1074 | 'import/no-named-as-default-member': 'error', 1075 | 1076 | // disallow use of jsdoc-marked-deprecated imports 1077 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md 1078 | 'import/no-deprecated': 'off', 1079 | 1080 | // Forbid the use of extraneous packages 1081 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md 1082 | // paths are treated both as absolute paths, and relative to process.cwd() 1083 | 'import/no-extraneous-dependencies': [0, { 1084 | devDependencies: [ 1085 | 'test/**', // tape, common npm pattern 1086 | 'tests/**', // also common npm pattern 1087 | 'spec/**', // mocha, rspec-like pattern 1088 | '**/__tests__/**', // jest pattern 1089 | 'test.js', // repos with a single test file 1090 | 'test-*.js', // repos with multiple top-level test files 1091 | '**/*.test.js', // tests where the extension denotes that it is a test 1092 | 'webpack/**/*.js', // webpack config 1093 | 'webpack/**/*.js', // webpack config 1094 | '**/rollup.config.js', // rollup config 1095 | '**/gulpfile.js', // gulp config 1096 | '**/gulpfile.*.js', // gulp config 1097 | '**/Gruntfile', // grunt config 1098 | ], 1099 | optionalDependencies: false, 1100 | }], 1101 | 1102 | // Forbid mutable exports 1103 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md 1104 | 'import/no-mutable-exports': 'error', 1105 | 1106 | // Module systems: 1107 | 1108 | // disallow require() 1109 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md 1110 | 'import/no-commonjs': 'off', 1111 | 1112 | // disallow AMD require/define 1113 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md 1114 | 'import/no-amd': 'error', 1115 | 1116 | // No Node.js builtin modules 1117 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md 1118 | // TODO: enable? 1119 | 'import/no-nodejs-modules': 'off', 1120 | 1121 | // Style guide: 1122 | 1123 | // disallow non-import statements appearing before import statements 1124 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md 1125 | 'import/first': ['error', 'absolute-first'], 1126 | 1127 | // disallow non-import statements appearing before import statements 1128 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md 1129 | // deprecated: use `import/first` 1130 | 'import/imports-first': 'off', 1131 | 1132 | // disallow duplicate imports 1133 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md 1134 | 'import/no-duplicates': 'error', 1135 | 1136 | // disallow namespace imports 1137 | // TODO: enable? 1138 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md 1139 | 'import/no-namespace': 'off', 1140 | 1141 | // Ensure consistent use of file extension within the import path 1142 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md 1143 | 'import/extensions': ['error', 'always', { 1144 | js: 'never', 1145 | jsx: 'never', 1146 | styl: 'never', 1147 | //css: 'never', 1148 | }], 1149 | 1150 | // Enforce a convention in module import order 1151 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md 1152 | // TODO: enable? 1153 | 'import/order': ['off', { 1154 | groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], 1155 | 'newlines-between': 'never', 1156 | }], 1157 | 1158 | // Require a newline after the last import/require in a group 1159 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md 1160 | 'import/newline-after-import': 'error', 1161 | 1162 | // Require modules with a single export to use a default export 1163 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md 1164 | 'import/prefer-default-export': 'warn', 1165 | 1166 | // Restrict which files can be imported in a given folder 1167 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md 1168 | 'import/no-restricted-paths': 'off', 1169 | 1170 | // Forbid modules to have too many dependencies 1171 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md 1172 | 'import/max-dependencies': ['off', { max: 10 }], 1173 | 1174 | // Forbid import of modules using absolute paths 1175 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md 1176 | 'import/no-absolute-path': 'error', 1177 | 1178 | // Forbid require() calls with expressions 1179 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md 1180 | 'import/no-dynamic-require': 'error', 1181 | 1182 | // prevent importing the submodules of other modules 1183 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md 1184 | 'import/no-internal-modules': ['off', { 1185 | allow: [], 1186 | }], 1187 | 1188 | // Warn if a module could be mistakenly parsed as a script by a consumer 1189 | // leveraging Unambiguous JavaScript Grammar 1190 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md 1191 | // this should not be enabled until this proposal has at least been *presented* to TC39. 1192 | // At the moment, it's not a thing. 1193 | 'import/unambiguous': 'off', 1194 | 1195 | // Forbid Webpack loader syntax in imports 1196 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md 1197 | 'import/no-webpack-loader-syntax': 'error', 1198 | 1199 | // Prevent unassigned imports 1200 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md 1201 | // importing for side effects is perfectly acceptable, if you need side effects. 1202 | 'import/no-unassigned-import': 'off', 1203 | 1204 | // Prevent importing the default as if it were named 1205 | // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md 1206 | 'import/no-named-default': 'error', 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | // AIRBNB STYLE: 1215 | // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js 1216 | 1217 | // enforce spacing inside array brackets 1218 | 'array-bracket-spacing': ['error', 'never'], 1219 | 1220 | // enforce spacing inside single-line blocks 1221 | // http://eslint.org/docs/rules/block-spacing 1222 | 'block-spacing': ['error', 'always'], 1223 | 1224 | // enforce one true brace style 1225 | 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }], 1226 | 1227 | // require camel case names 1228 | camelcase: 0, 1229 | 1230 | // enforce or disallow capitalization of the first letter of a comment 1231 | // http://eslint.org/docs/rules/capitalized-comments 1232 | 'capitalized-comments': ['off', 'never', { 1233 | line: { 1234 | ignorePattern: '.*', 1235 | ignoreInlineComments: true, 1236 | ignoreConsecutiveComments: true, 1237 | }, 1238 | block: { 1239 | ignorePattern: '.*', 1240 | ignoreInlineComments: true, 1241 | ignoreConsecutiveComments: true, 1242 | }, 1243 | }], 1244 | 1245 | // enforce spacing before and after comma 1246 | 'comma-spacing': ['error', { before: false, after: true }], 1247 | 1248 | // enforce one true comma style 1249 | 'comma-style': ['error', 'last'], 1250 | 1251 | // disallow padding inside computed properties 1252 | 'computed-property-spacing': ['error', 'never'], 1253 | 1254 | // enforces consistent naming when capturing the current execution context 1255 | 'consistent-this': 'off', 1256 | 1257 | // enforce newline at the end of file, with no multiple empty lines 1258 | 'eol-last': ['error', 'always'], 1259 | 1260 | // enforce spacing between functions and their invocations 1261 | // http://eslint.org/docs/rules/func-call-spacing 1262 | 'func-call-spacing': ['error', 'never'], 1263 | 1264 | // requires function names to match the name of the variable or property to which they are 1265 | // assigned 1266 | // http://eslint.org/docs/rules/func-name-matching 1267 | 'func-name-matching': ['off', 'always', { 1268 | includeCommonJSModuleExports: false 1269 | }], 1270 | 1271 | // require function expressions to have a name 1272 | // http://eslint.org/docs/rules/func-names 1273 | 'func-names': 'warn', 1274 | 1275 | // enforces use of function declarations or expressions 1276 | // http://eslint.org/docs/rules/func-style 1277 | // TODO: enable 1278 | 'func-style': ['off', 'expression'], 1279 | 1280 | // Blacklist certain identifiers to prevent them being used 1281 | // http://eslint.org/docs/rules/id-blacklist 1282 | 'id-blacklist': 'off', 1283 | 1284 | // this option enforces minimum and maximum identifier lengths 1285 | // (variable names, property names etc.) 1286 | 'id-length': 'off', 1287 | 1288 | // require identifiers to match the provided regular expression 1289 | 'id-match': 'off', 1290 | 1291 | // this option sets a specific tab width for your code 1292 | // http://eslint.org/docs/rules/indent 1293 | indent: ['error', 2, { 1294 | SwitchCase: 1, 1295 | VariableDeclarator: 1, 1296 | outerIIFEBody: 1, 1297 | // MemberExpression: null, 1298 | // CallExpression: { 1299 | // parameters: null, 1300 | // }, 1301 | FunctionDeclaration: { 1302 | parameters: 1, 1303 | body: 1 1304 | }, 1305 | FunctionExpression: { 1306 | parameters: 1, 1307 | body: 1 1308 | } 1309 | }], 1310 | 1311 | // specify whether double or single quotes should be used in JSX attributes 1312 | // http://eslint.org/docs/rules/jsx-quotes 1313 | 'jsx-quotes': ['off', 'prefer-double'], 1314 | 1315 | // enforces spacing between keys and values in object literal properties 1316 | 'key-spacing': ['error', { beforeColon: false, afterColon: true }], 1317 | 1318 | // require a space before & after certain keywords 1319 | 'keyword-spacing': ['error', { 1320 | before: true, 1321 | after: true, 1322 | overrides: { 1323 | return: { after: true }, 1324 | throw: { after: true }, 1325 | case: { after: true } 1326 | } 1327 | }], 1328 | 1329 | // enforce position of line comments 1330 | // http://eslint.org/docs/rules/line-comment-position 1331 | // TODO: enable? 1332 | 'line-comment-position': ['off', { 1333 | position: 'above', 1334 | ignorePattern: '', 1335 | applyDefaultPatterns: true, 1336 | }], 1337 | 1338 | // disallow mixed 'LF' and 'CRLF' as linebreaks 1339 | // http://eslint.org/docs/rules/linebreak-style 1340 | 'linebreak-style': ['error', 'unix'], 1341 | 1342 | // enforces empty lines around comments 1343 | 'lines-around-comment': 'off', 1344 | 1345 | // require or disallow newlines around directives 1346 | // http://eslint.org/docs/rules/lines-around-directive 1347 | 'lines-around-directive': ['error', { 1348 | before: 'always', 1349 | after: 'always', 1350 | }], 1351 | 1352 | // specify the maximum depth that blocks can be nested 1353 | 'max-depth': ['off', 4], 1354 | 1355 | // specify the maximum length of a line in your program 1356 | // http://eslint.org/docs/rules/max-len 1357 | 'max-len': ['error', 120, 2, { 1358 | ignoreUrls: true, 1359 | ignoreComments: true, 1360 | ignoreRegExpLiterals: true, 1361 | ignoreStrings: true, 1362 | ignoreTemplateLiterals: true, 1363 | }], 1364 | 1365 | // specify the max number of lines in a file 1366 | // http://eslint.org/docs/rules/max-lines 1367 | 'max-lines': ['off', { 1368 | max: 300, 1369 | skipBlankLines: true, 1370 | skipComments: true 1371 | }], 1372 | 1373 | // specify the maximum depth callbacks can be nested 1374 | 'max-nested-callbacks': 'off', 1375 | 1376 | // limits the number of parameters that can be used in the function declaration. 1377 | 'max-params': ['off', 3], 1378 | 1379 | // specify the maximum number of statement allowed in a function 1380 | 'max-statements': ['off', 10], 1381 | 1382 | // restrict the number of statements per line 1383 | // http://eslint.org/docs/rules/max-statements-per-line 1384 | 'max-statements-per-line': ['off', { max: 1 }], 1385 | 1386 | // require multiline ternary 1387 | // http://eslint.org/docs/rules/multiline-ternary 1388 | // TODO: enable? 1389 | 'multiline-ternary': ['off', 'never'], 1390 | 1391 | // require a capital letter for constructors 1392 | 'new-cap': ['error', { 1393 | newIsCap: true, 1394 | newIsCapExceptions: [], 1395 | capIsNew: false, 1396 | capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'], 1397 | }], 1398 | 1399 | // disallow the omission of parentheses when invoking a constructor with no arguments 1400 | // http://eslint.org/docs/rules/new-parens 1401 | 'new-parens': 'error', 1402 | 1403 | // allow/disallow an empty newline after var statement 1404 | 'newline-after-var': 'off', 1405 | 1406 | // http://eslint.org/docs/rules/newline-before-return 1407 | 'newline-before-return': 'off', 1408 | 1409 | // enforces new line after each method call in the chain to make it 1410 | // more readable and easy to maintain 1411 | // http://eslint.org/docs/rules/newline-per-chained-call 1412 | 'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }], 1413 | 1414 | // disallow use of the Array constructor 1415 | 'no-array-constructor': 'error', 1416 | 1417 | // disallow use of bitwise operators 1418 | // http://eslint.org/docs/rules/no-bitwise 1419 | 'no-bitwise': 'error', 1420 | 1421 | // disallow use of the continue statement 1422 | // http://eslint.org/docs/rules/no-continue 1423 | 'no-continue': 'error', 1424 | 1425 | // disallow comments inline after code 1426 | 'no-inline-comments': 'off', 1427 | 1428 | // disallow if as the only statement in an else block 1429 | // http://eslint.org/docs/rules/no-lonely-if 1430 | 'no-lonely-if': 'error', 1431 | 1432 | // disallow un-paren'd mixes of different operators 1433 | // http://eslint.org/docs/rules/no-mixed-operators 1434 | 'no-mixed-operators': ['error', { 1435 | groups: [ 1436 | ['+', '-', '*', '/', '%', '**'], 1437 | ['&', '|', '^', '~', '<<', '>>', '>>>'], 1438 | ['==', '!=', '===', '!==', '>', '>=', '<', '<='], 1439 | ['&&', '||'], 1440 | ['in', 'instanceof'] 1441 | ], 1442 | allowSamePrecedence: false 1443 | }], 1444 | 1445 | // disallow mixed spaces and tabs for indentation 1446 | 'no-mixed-spaces-and-tabs': 'error', 1447 | 1448 | // disallow multiple empty lines and only one newline at the end 1449 | 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }], 1450 | 1451 | // disallow negated conditions 1452 | // http://eslint.org/docs/rules/no-negated-condition 1453 | 'no-negated-condition': 'off', 1454 | 1455 | // disallow nested ternary expressions 1456 | 'no-nested-ternary': 0, 1457 | 1458 | // disallow use of the Object constructor 1459 | 'no-new-object': 'error', 1460 | 1461 | // disallow use of unary operators, ++ and -- 1462 | // http://eslint.org/docs/rules/no-plusplus 1463 | 'no-plusplus': 0, 1464 | 1465 | // disallow certain syntax forms 1466 | // http://eslint.org/docs/rules/no-restricted-syntax 1467 | 'no-restricted-syntax': [ 1468 | 'error', 1469 | //'ForInStatement', 1470 | 'ForOfStatement', 1471 | 'LabeledStatement', 1472 | 'WithStatement', 1473 | ], 1474 | 1475 | // disallow space between function identifier and application 1476 | 'no-spaced-func': 'error', 1477 | 1478 | // disallow tab characters entirely 1479 | 'no-tabs': 'error', 1480 | 1481 | // disallow the use of ternary operators 1482 | 'no-ternary': 'off', 1483 | 1484 | // disallow trailing whitespace at the end of lines 1485 | 'no-trailing-spaces': 'error', 1486 | 1487 | // disallow dangling underscores in identifiers 1488 | 'no-underscore-dangle': 0, 1489 | 1490 | // disallow the use of Boolean literals in conditional expressions 1491 | // also, prefer `a || b` over `a ? a : b` 1492 | // http://eslint.org/docs/rules/no-unneeded-ternary 1493 | 'no-unneeded-ternary': ['error', { defaultAssignment: false }], 1494 | 1495 | // disallow whitespace before properties 1496 | // http://eslint.org/docs/rules/no-whitespace-before-property 1497 | 'no-whitespace-before-property': 'error', 1498 | 1499 | // require padding inside curly braces 1500 | 'object-curly-spacing': ['error', 'always'], 1501 | 1502 | // enforce line breaks between braces 1503 | // http://eslint.org/docs/rules/object-curly-newline 1504 | // TODO: enable once https://github.com/eslint/eslint/issues/6488 is resolved 1505 | 'object-curly-newline': ['off', { 1506 | ObjectExpression: { minProperties: 0, multiline: true }, 1507 | ObjectPattern: { minProperties: 0, multiline: true } 1508 | }], 1509 | 1510 | // enforce "same line" or "multiple line" on object properties. 1511 | // http://eslint.org/docs/rules/object-property-newline 1512 | 'object-property-newline': ['error', { 1513 | allowMultiplePropertiesPerLine: true, 1514 | }], 1515 | 1516 | // allow just one var statement per function 1517 | 'one-var': ['error', 'never'], 1518 | 1519 | // require a newline around variable declaration 1520 | // http://eslint.org/docs/rules/one-var-declaration-per-line 1521 | 'one-var-declaration-per-line': ['error', 'always'], 1522 | 1523 | // require assignment operator shorthand where possible or prohibit it entirely 1524 | // http://eslint.org/docs/rules/operator-assignment 1525 | 'operator-assignment': ['error', 'always'], 1526 | 1527 | // enforce operators to be placed before or after line breaks 1528 | 'operator-linebreak': 'off', 1529 | 1530 | // enforce padding within blocks 1531 | 'padded-blocks': ['error', 'never'], 1532 | 1533 | // require quotes around object literal property names 1534 | // http://eslint.org/docs/rules/quote-props.html 1535 | 'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }], 1536 | 1537 | // specify whether double or single quotes should be used 1538 | quotes: ['error', 'single', { avoidEscape: true }], 1539 | 1540 | // do not require jsdoc 1541 | // http://eslint.org/docs/rules/require-jsdoc 1542 | 'require-jsdoc': 'off', 1543 | 1544 | // require or disallow use of semicolons instead of ASI 1545 | semi: ['error', 'never'], 1546 | 1547 | // enforce spacing before and after semicolons 1548 | 'semi-spacing': ['error', { before: false, after: true }], 1549 | 1550 | // requires object keys to be sorted 1551 | 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }], 1552 | 1553 | // sort variables within the same declaration block 1554 | 'sort-vars': 'off', 1555 | 1556 | // require or disallow space before blocks 1557 | 'space-before-blocks': 'error', 1558 | 1559 | // require or disallow space before function opening parenthesis 1560 | // http://eslint.org/docs/rules/space-before-function-paren 1561 | 'space-before-function-paren': ['error', { 1562 | anonymous: 'always', 1563 | named: 'never', 1564 | asyncArrow: 'always' 1565 | }], 1566 | 1567 | // require or disallow spaces inside parentheses 1568 | 'space-in-parens': ['error', 'never'], 1569 | 1570 | // require spaces around operators 1571 | 'space-infix-ops': 'error', 1572 | 1573 | // Require or disallow spaces before/after unary operators 1574 | // http://eslint.org/docs/rules/space-unary-ops 1575 | 'space-unary-ops': ['error', { 1576 | words: true, 1577 | nonwords: false, 1578 | overrides: { 1579 | }, 1580 | }], 1581 | 1582 | // require or disallow a space immediately following the // or /* in a comment 1583 | // http://eslint.org/docs/rules/spaced-comment 1584 | 'spaced-comment': ['error', 'always', { 1585 | line: { 1586 | exceptions: ['-', '+'], 1587 | markers: ['=', '!'], // space here to support sprockets directives 1588 | }, 1589 | block: { 1590 | exceptions: ['-', '+'], 1591 | markers: ['=', '!'], // space here to support sprockets directives 1592 | balanced: false, 1593 | } 1594 | }], 1595 | 1596 | // require or disallow the Unicode Byte Order Mark 1597 | // http://eslint.org/docs/rules/unicode-bom 1598 | 'unicode-bom': ['error', 'never'], 1599 | 1600 | // require regex literals to be wrapped in parentheses 1601 | 'wrap-regex': 'off', 1602 | } 1603 | } 1604 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | /node_modules/fbjs 3 | /node_modules/json 4 | 5 | [include] 6 | 7 | [libs] 8 | 9 | [options] 10 | 11 | esproposal.class_static_fields=enable 12 | esproposal.class_instance_fields=enable 13 | 14 | module.file_ext=.js 15 | module.file_ext=.json 16 | module.system=haste 17 | 18 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe 19 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | distStorybook 4 | .DS_Store 5 | npm-debug.log 6 | *.log 7 | .vscode 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | coverage 2 | __test-helpers__ 3 | __tests__ 4 | __fixtures__ 5 | docs 6 | flow-typed 7 | src 8 | *.log 9 | 10 | .babelrc 11 | .codeclimate.yml 12 | .editorconfig 13 | .eslintrc.js 14 | .snyk 15 | .travis.yml 16 | wallaby.js 17 | webpack.config.js 18 | .eslintignore 19 | .flowconfig 20 | *.png 21 | .vscode 22 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "javascript.validate.enable" : false, 4 | "flow.pathToFlow": "flow", 5 | "flow.stopFlowOnExit": true, 6 | "flow.enabled": true, 7 | "flow.useNPMPackagedFlow": true 8 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 celebvidy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TransitionGroup 2 | 3 | `TransitionGroup` is a sound answer to `` and any wishlist you might have had for it. 4 | We suggest you become familiar with it and its higher level CSS-oriented counterpart first to truly understand `TransitionGroups`'s benefits: 5 | 6 | * [ReactCSSTransitionGroup](https://facebook.github.io/react/docs/animation.html) 7 | * [ReactTransitionGroup](https://facebook.github.io/react/docs/animation.html#low-level-api-reacttransitiongroup) 8 | 9 | 10 | The biggest problem `TransitionGroup` solves is that you can ***both*** provide callbacks for the 3 transitions (`appear`, `enter`, `leave`) ***AND*** 11 | have your css classes applied. `ReactCSSTransitionGroup` does not allow for callbacks. 12 | 13 | However, we've taken it one step farther to allow you to customize each individual child component rendered within the group. So that 14 | means you can provide props (such as animation duration, delay, etc) that apply to all children by setting them at the group level, 15 | ***OR*** you can override them by passing the props to the `` components that wrap your actual children. 16 | 17 | *Note: unlike `ReactTransitionGroup` 18 | and `ReactCSSTransitionGroup` all child components are required to be wrapped in ``.* 19 | 20 | Lastly, we offer simpler prop names and a lot more customization: 21 | 22 | * **duration** (`duration`, `appearDuration`, `enterDuration`, `leaveDuration`) 23 | * **delay** (`delay`, `appearDelay`, `enterDelay`, `leaveDelay`) 24 | * **class names** (the `appear`, `enter`, and `leave` props) 25 | * **a prefix** (prepended to all classes) 26 | 27 | ## Installation 28 | ```yarn add transition-group``` 29 | 30 | 31 | ## Usage 32 | 33 | ```javascript 34 | import React from 'react' 35 | import { connect } from 'react-redux' 36 | import { TransitionGroup, Transition } from 'transition-group' 37 | 38 | const onLeave = () => console.log('left') 39 | const onEmpty = () => console.log('group empty') 40 | 41 | const PageSwitcher = ({ page }) => 42 | 50 | 51 | {getComponent(page)} 52 | 53 | 54 | // don't show link for the current page: 55 | 56 | {page !== 'Home' && HOME} 57 | {page !== 'List' && LIST} 58 | {page !== 'Video' && VIDEO} 59 | 60 | 61 | 62 | const getComponent = page => { 63 | switch(page) { 64 | case 'Home': 65 | return 66 | case 'List': 67 | return 68 | case 'Video': 69 | return