diff --git a/.travis.yml b/.travis.yml index 0ccdfb3b9..d5da7f467 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,8 @@ language: node_js node_js: - - 4 - 6 - 8 - 9 -matrix: - allow_failures: - - node_js: 4 cache: directories: - node_modules @@ -18,15 +14,11 @@ script: - npm run lint # Run tests and Danger.js - | - if [[ "$TRAVIS_NODE_VERSION" == "4" ]]; then - NODE_ENV=test node --harmony-proxies $(npm bin)/jest --runInBand + if [[ "$TRAVIS_NODE_VERSION" == "9" ]]; then + npx danger ci + npm run test:coverage -- --runInBand else - if [[ "$TRAVIS_NODE_VERSION" == "9" ]]; then - npx danger ci - npm run test:coverage -- --runInBand - else - npm run test:jest -- --runInBand - fi + npm run test:jest -- --runInBand fi # Compile code - npm run compile @@ -35,7 +27,7 @@ script: - npm run build:customised - npm run build:sections - | - if [[ "$TRAVIS_NODE_VERSION" == "8" ]]; then + if [[ "$TRAVIS_NODE_VERSION" == "9" ]]; then # Check that examples really works: no JS errors on load npm run test:browser:pre npm run test:browser diff --git a/bin/.eslintrc b/bin/.eslintrc index 0a5ad254e..b1ac0de2f 100644 --- a/bin/.eslintrc +++ b/bin/.eslintrc @@ -4,7 +4,6 @@ "sourceType": "script" }, "rules": { - "strict": [2, "global"], "es5/no-default-parameters": 2, "es5/no-destructuring": 2, "es5/no-spread": 2 diff --git a/bin/__tests__/styleguidist.spec.js b/bin/__tests__/styleguidist.spec.js index 1d9ab34ab..600706641 100644 --- a/bin/__tests__/styleguidist.spec.js +++ b/bin/__tests__/styleguidist.spec.js @@ -1,5 +1,3 @@ -'use strict'; - const fs = require('fs'); const vm = require('vm'); const path = require('path'); diff --git a/bin/styleguidist.js b/bin/styleguidist.js index 916732315..77a188b1e 100755 --- a/bin/styleguidist.js +++ b/bin/styleguidist.js @@ -1,5 +1,4 @@ #!/usr/bin/env node -'use strict'; /* eslint-disable no-console */ const minimist = require('minimist'); diff --git a/loaders/.eslintrc b/loaders/.eslintrc index 2b08b15bd..5d07fa2b6 100644 --- a/loaders/.eslintrc +++ b/loaders/.eslintrc @@ -5,7 +5,6 @@ }, "rules": { "no-invalid-this": 0, - "strict": [2, "global"], "es5/no-default-parameters": 2, "es5/no-destructuring": 2, "es5/no-spread": 2 diff --git a/loaders/css-loader.js b/loaders/css-loader.js index 760ceee84..3d88f8f34 100644 --- a/loaders/css-loader.js +++ b/loaders/css-loader.js @@ -1,5 +1,3 @@ -'use strict'; - /* We’re not using Webpack loader resolver because its behavior can be changed by user‘s Webpack config (Create React App does that for example). This way we can bypass Webpack resolver and just use Node resolver. Should be used like this: diff --git a/loaders/examples-loader.js b/loaders/examples-loader.js index db37b1cc0..6ef3eb173 100644 --- a/loaders/examples-loader.js +++ b/loaders/examples-loader.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const filter = require('lodash/filter'); const map = require('lodash/map'); diff --git a/loaders/props-loader.js b/loaders/props-loader.js index 5babe0625..b0fe03435 100644 --- a/loaders/props-loader.js +++ b/loaders/props-loader.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const isArray = require('lodash/isArray'); const reactDocs = require('react-docgen'); diff --git a/loaders/style-loader.js b/loaders/style-loader.js index 08efdd5a7..abbaa6cd0 100644 --- a/loaders/style-loader.js +++ b/loaders/style-loader.js @@ -4,6 +4,4 @@ does that for example). This way we can bypass Webpack resolver and just use Nod require('!!../../../loaders/style-loader!../../../loaders/css-loader!codemirror/lib/codemirror.css'); */ -'use strict'; - module.exports = require('style-loader'); diff --git a/loaders/styleguide-loader.js b/loaders/styleguide-loader.js index 6e6976ee5..76693bfb3 100644 --- a/loaders/styleguide-loader.js +++ b/loaders/styleguide-loader.js @@ -1,5 +1,3 @@ -'use strict'; - const pick = require('lodash/pick'); const commonDir = require('common-dir'); const generate = require('escodegen').generate; diff --git a/loaders/utils/chunkify.js b/loaders/utils/chunkify.js index ee71ac640..324c782d4 100644 --- a/loaders/utils/chunkify.js +++ b/loaders/utils/chunkify.js @@ -1,5 +1,3 @@ -'use strict'; - const remark = require('remark'); const visit = require('unist-util-visit'); const highlightCode = require('./highlightCode'); diff --git a/loaders/utils/client/evalInContext.js b/loaders/utils/client/evalInContext.js index ec8492d13..1992d5d01 100644 --- a/loaders/utils/client/evalInContext.js +++ b/loaders/utils/client/evalInContext.js @@ -1,5 +1,3 @@ -'use strict'; - // WARNING: This function’s source is returned by a loader without transpilation. // Do not use any unsupported by IE11+ features. diff --git a/loaders/utils/client/requireInRuntime.js b/loaders/utils/client/requireInRuntime.js index 43c42d1d7..65775e9d1 100644 --- a/loaders/utils/client/requireInRuntime.js +++ b/loaders/utils/client/requireInRuntime.js @@ -1,5 +1,3 @@ -'use strict'; - // WARNING: This function’s source is returned by a loader without transpilation. // Do not use any unsupported by IE11+ features. diff --git a/loaders/utils/expandDefaultComponent.js b/loaders/utils/expandDefaultComponent.js index a7003f6a2..d7b5a09aa 100644 --- a/loaders/utils/expandDefaultComponent.js +++ b/loaders/utils/expandDefaultComponent.js @@ -1,5 +1,3 @@ -'use strict'; - const COMPONENT_PLACEHOLDER = '__COMPONENT__'; const COMPONENT_PLACEHOLDER_REGEXP = new RegExp(COMPONENT_PLACEHOLDER, 'g'); diff --git a/loaders/utils/filterComponentsWithExample.js b/loaders/utils/filterComponentsWithExample.js index 79c3038e8..9c75b8a59 100644 --- a/loaders/utils/filterComponentsWithExample.js +++ b/loaders/utils/filterComponentsWithExample.js @@ -1,5 +1,3 @@ -'use strict'; - /** * Filter out components without an example file. * diff --git a/loaders/utils/getAllContentPages.js b/loaders/utils/getAllContentPages.js index d907f5528..7df80d2b1 100644 --- a/loaders/utils/getAllContentPages.js +++ b/loaders/utils/getAllContentPages.js @@ -1,5 +1,3 @@ -'use strict'; - /** * Get all section content pages. * diff --git a/loaders/utils/getComponentFiles.js b/loaders/utils/getComponentFiles.js index 9fa4cfcbd..bdaa3b565 100644 --- a/loaders/utils/getComponentFiles.js +++ b/loaders/utils/getComponentFiles.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const glob = require('glob'); const isFunction = require('lodash/isFunction'); diff --git a/loaders/utils/getComponentFilesFromSections.js b/loaders/utils/getComponentFilesFromSections.js index f2a418d8c..27c4b455d 100644 --- a/loaders/utils/getComponentFilesFromSections.js +++ b/loaders/utils/getComponentFilesFromSections.js @@ -1,5 +1,3 @@ -'use strict'; - const getComponentFiles = require('./getComponentFiles'); /** diff --git a/loaders/utils/getComponentPatternsFromSections.js b/loaders/utils/getComponentPatternsFromSections.js index ae8139bf4..a7fb9521e 100644 --- a/loaders/utils/getComponentPatternsFromSections.js +++ b/loaders/utils/getComponentPatternsFromSections.js @@ -1,5 +1,3 @@ -'use strict'; - /** * Return all glob patterns from all sections. * diff --git a/loaders/utils/getComponents.js b/loaders/utils/getComponents.js index 25e441bf3..f637bcc9c 100644 --- a/loaders/utils/getComponents.js +++ b/loaders/utils/getComponents.js @@ -1,5 +1,3 @@ -'use strict'; - const processComponent = require('./processComponent'); /** diff --git a/loaders/utils/getExamples.js b/loaders/utils/getExamples.js index 5969637ca..fa899422b 100644 --- a/loaders/utils/getExamples.js +++ b/loaders/utils/getExamples.js @@ -1,5 +1,3 @@ -'use strict'; - const fs = require('fs'); const path = require('path'); const requireIt = require('./requireIt'); diff --git a/loaders/utils/getNameFromFilePath.js b/loaders/utils/getNameFromFilePath.js index 8c05f0a11..1482a535a 100644 --- a/loaders/utils/getNameFromFilePath.js +++ b/loaders/utils/getNameFromFilePath.js @@ -1,4 +1,3 @@ -'use strict'; const path = require('path'); const _ = require('lodash'); diff --git a/loaders/utils/getProps.js b/loaders/utils/getProps.js index d7965579b..f89cd5290 100644 --- a/loaders/utils/getProps.js +++ b/loaders/utils/getProps.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const fs = require('fs'); const reactDocs = require('react-docgen'); diff --git a/loaders/utils/getRequires.js b/loaders/utils/getRequires.js index 08d98b6cf..dd703c45d 100644 --- a/loaders/utils/getRequires.js +++ b/loaders/utils/getRequires.js @@ -1,5 +1,3 @@ -'use strict'; - // Need to supply the regex test as a string for reuse in unit tests // Currently, trying to change flags throws a TypeError // Slated for change in ES6, but not possible now: diff --git a/loaders/utils/getSections.js b/loaders/utils/getSections.js index 7aec2f4fe..ab8f65779 100644 --- a/loaders/utils/getSections.js +++ b/loaders/utils/getSections.js @@ -1,5 +1,3 @@ -'use strict'; - // This two functions should be in the same file because of cyclic imports const fs = require('fs'); diff --git a/loaders/utils/highlightCode.js b/loaders/utils/highlightCode.js index 902649931..08f5d7951 100644 --- a/loaders/utils/highlightCode.js +++ b/loaders/utils/highlightCode.js @@ -1,5 +1,3 @@ -'use strict'; - const hljs = require('highlight.js'); /** diff --git a/loaders/utils/highlightCodeInMarkdown.js b/loaders/utils/highlightCodeInMarkdown.js index bbb3d2cf1..47381199d 100644 --- a/loaders/utils/highlightCodeInMarkdown.js +++ b/loaders/utils/highlightCodeInMarkdown.js @@ -1,5 +1,3 @@ -'use strict'; - const remark = require('remark'); const visit = require('unist-util-visit'); const highlightCode = require('./highlightCode'); diff --git a/loaders/utils/parseExample.js b/loaders/utils/parseExample.js index a68ba3a0d..cffa03d88 100644 --- a/loaders/utils/parseExample.js +++ b/loaders/utils/parseExample.js @@ -1,5 +1,3 @@ -'use strict'; - const consts = require('../../scripts/consts'); const lowercaseKeys = require('lowercase-keys'); diff --git a/loaders/utils/processComponent.js b/loaders/utils/processComponent.js index 8f02267e4..31ad055ab 100644 --- a/loaders/utils/processComponent.js +++ b/loaders/utils/processComponent.js @@ -1,5 +1,3 @@ -'use strict'; - const fs = require('fs'); const path = require('path'); const getNameFromFilePath = require('./getNameFromFilePath'); diff --git a/loaders/utils/removeDoclets.js b/loaders/utils/removeDoclets.js index 2355f47e1..e241d56b3 100644 --- a/loaders/utils/removeDoclets.js +++ b/loaders/utils/removeDoclets.js @@ -1,5 +1,3 @@ -'use strict'; - // Doclet regexp from react-docgen const DOCLET_REGEXP = /^@(\w+)(?:$|\s((?:[^](?!^@\w))*))/gim; diff --git a/loaders/utils/requireIt.js b/loaders/utils/requireIt.js index 3938db455..2966a33e9 100644 --- a/loaders/utils/requireIt.js +++ b/loaders/utils/requireIt.js @@ -1,5 +1,3 @@ -'use strict'; - const b = require('ast-types').builders; /** diff --git a/loaders/utils/slugger.js b/loaders/utils/slugger.js index f36355196..9b26ecb71 100644 --- a/loaders/utils/slugger.js +++ b/loaders/utils/slugger.js @@ -1,5 +1,3 @@ -'use strict'; - const GithubSlugger = require('github-slugger'); // Export the singleton instance of GithubSlugger diff --git a/loaders/utils/sortProps.js b/loaders/utils/sortProps.js index 934263db6..b121e7a49 100644 --- a/loaders/utils/sortProps.js +++ b/loaders/utils/sortProps.js @@ -1,5 +1,3 @@ -'use strict'; - const sortBy = require('lodash/sortBy'); /** diff --git a/package.json b/package.json index 10d3680a7..355ceaea5 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "scripts" ], "engines": { - "node": ">=4", + "node": ">=6", "npm": ">=3" }, "dependencies": { diff --git a/scripts/.eslintrc b/scripts/.eslintrc index 0a5ad254e..b1ac0de2f 100644 --- a/scripts/.eslintrc +++ b/scripts/.eslintrc @@ -4,7 +4,6 @@ "sourceType": "script" }, "rules": { - "strict": [2, "global"], "es5/no-default-parameters": 2, "es5/no-destructuring": 2, "es5/no-spread": 2 diff --git a/scripts/__mocks__/build.js b/scripts/__mocks__/build.js index 1cdd36701..3f9fdeecc 100644 --- a/scripts/__mocks__/build.js +++ b/scripts/__mocks__/build.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = function server(config, callback) { callback(null, { stats: true }); return {}; diff --git a/scripts/__mocks__/server.js b/scripts/__mocks__/server.js index b470a7a4b..85380fbfc 100644 --- a/scripts/__mocks__/server.js +++ b/scripts/__mocks__/server.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = function server(config, callback) { callback(null); return {}; diff --git a/scripts/build.js b/scripts/build.js index 63ac28499..66f682d2b 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,5 +1,3 @@ -'use strict'; - const webpack = require('webpack'); const makeWebpackConfig = require('./make-webpack-config'); diff --git a/scripts/config.js b/scripts/config.js index cfd8678f0..5d3478fcb 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -1,5 +1,3 @@ -'use strict'; - const fs = require('fs'); const path = require('path'); const findup = require('findup'); diff --git a/scripts/consts.js b/scripts/consts.js index 4984abdb0..6a5591d31 100644 --- a/scripts/consts.js +++ b/scripts/consts.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { HOMEPAGE: 'https://react-styleguidist.js.org/', BUGS: 'https://github.com/styleguidist/react-styleguidist/issues', diff --git a/scripts/create-server.js b/scripts/create-server.js index 6105ffe2c..102dbe684 100644 --- a/scripts/create-server.js +++ b/scripts/create-server.js @@ -1,5 +1,3 @@ -'use strict'; - const webpack = require('webpack'); const WebpackDevServer = require('webpack-dev-server'); const merge = require('webpack-merge'); diff --git a/scripts/index.js b/scripts/index.js index d584c924e..01b710c81 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -1,5 +1,3 @@ -'use strict'; - // Make sure user has webpack installed require('./utils/ensureWebpack'); diff --git a/scripts/logger.js b/scripts/logger.js index 84c7742dd..ae52b7c89 100644 --- a/scripts/logger.js +++ b/scripts/logger.js @@ -1,4 +1,3 @@ -'use strict'; /* eslint-disable no-console */ const _ = require('lodash/fp'); diff --git a/scripts/make-webpack-config.js b/scripts/make-webpack-config.js index a76b2d3f1..9cf471c1b 100644 --- a/scripts/make-webpack-config.js +++ b/scripts/make-webpack-config.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); const webpack = require('webpack'); const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); diff --git a/scripts/schemas/config.js b/scripts/schemas/config.js index 50c5b689d..403b6dc84 100644 --- a/scripts/schemas/config.js +++ b/scripts/schemas/config.js @@ -1,5 +1,3 @@ -'use strict'; - // If you want to access any of these options in React, don’t forget to update CLIENT_CONFIG_OPTIONS array // in loaders/styleguide-loader.js diff --git a/scripts/server.js b/scripts/server.js index aab931648..a2905fe56 100644 --- a/scripts/server.js +++ b/scripts/server.js @@ -1,5 +1,3 @@ -'use strict'; - const createServer = require('./create-server'); module.exports = function server(config, callback) { diff --git a/scripts/utils/StyleguidistOptionsPlugin.js b/scripts/utils/StyleguidistOptionsPlugin.js index c2b4a0468..a824111a8 100644 --- a/scripts/utils/StyleguidistOptionsPlugin.js +++ b/scripts/utils/StyleguidistOptionsPlugin.js @@ -1,5 +1,3 @@ -'use strict'; - // Webpack plugin that makes Styleguidist config available for Styleguidist webpack loaders. // It will be available as `this._styleguidist`. // diff --git a/scripts/utils/ensureWebpack.js b/scripts/utils/ensureWebpack.js index 0b3f0beea..19776157a 100644 --- a/scripts/utils/ensureWebpack.js +++ b/scripts/utils/ensureWebpack.js @@ -1,5 +1,3 @@ -'use strict'; - /** * Check webpack availability and version at run time instead of using peerDependencies to allow * usage of build tools that contains webpack as their own dependency, like Create React App. diff --git a/scripts/utils/error.js b/scripts/utils/error.js index 3497e630c..5f3ff01c5 100644 --- a/scripts/utils/error.js +++ b/scripts/utils/error.js @@ -1,5 +1,3 @@ -'use strict'; - class StyleguidistError extends Error { constructor(message, extra) { super(message); diff --git a/scripts/utils/findFileCaseInsensitive.js b/scripts/utils/findFileCaseInsensitive.js index 38860b459..5722e3a8d 100644 --- a/scripts/utils/findFileCaseInsensitive.js +++ b/scripts/utils/findFileCaseInsensitive.js @@ -1,5 +1,3 @@ -'use strict'; - const fs = require('fs'); const path = require('path'); const memoize = require('lodash/memoize'); diff --git a/scripts/utils/findUserWebpackConfig.js b/scripts/utils/findUserWebpackConfig.js index 9677301ec..a64ec7c1c 100644 --- a/scripts/utils/findUserWebpackConfig.js +++ b/scripts/utils/findUserWebpackConfig.js @@ -1,5 +1,3 @@ -'use strict'; - const fs = require('fs'); const path = require('path'); diff --git a/scripts/utils/getUserPackageJson.js b/scripts/utils/getUserPackageJson.js index 1fec0e831..15a05f138 100644 --- a/scripts/utils/getUserPackageJson.js +++ b/scripts/utils/getUserPackageJson.js @@ -1,5 +1,3 @@ -'use strict'; - const path = require('path'); /** diff --git a/scripts/utils/getWebpackVersion.js b/scripts/utils/getWebpackVersion.js index 507e2b30d..f460618ca 100644 --- a/scripts/utils/getWebpackVersion.js +++ b/scripts/utils/getWebpackVersion.js @@ -1,5 +1,3 @@ -'use strict'; - const semverUtils = require('semver-utils'); /** diff --git a/scripts/utils/mergeWebpackConfig.js b/scripts/utils/mergeWebpackConfig.js index ea729dbee..641f08500 100644 --- a/scripts/utils/mergeWebpackConfig.js +++ b/scripts/utils/mergeWebpackConfig.js @@ -1,5 +1,3 @@ -'use strict'; - const isFunction = require('lodash/isFunction'); const omit = require('lodash/omit'); const mergeBase = require('webpack-merge'); diff --git a/scripts/utils/sanitizeConfig.js b/scripts/utils/sanitizeConfig.js index afe1d91a3..21d22df4d 100644 --- a/scripts/utils/sanitizeConfig.js +++ b/scripts/utils/sanitizeConfig.js @@ -1,5 +1,3 @@ -'use strict'; - const fs = require('fs'); const path = require('path'); const isDirectory = require('is-directory');