This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up & simplify the project (#26)
* Update ESLint and Babel config - ESLint: use babel-eslint parser for parity with Babel-supported syntax - Babel: use the minimal set of plugins for successful code compilation * Use the latest version of Yarn for Travis CI builds * Use our Cosmos config together with react-cosmos-test/enzyme
- Loading branch information
1 parent
fae92e7
commit 24bf17d
Showing
55 changed files
with
3,214 additions
and
5,217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# https://github.com/browserslist/browserslist | ||
|
||
# include browsers based on global coverage | ||
> 1% | ||
|
||
# exclude all Internet Explorer versions | ||
not ie > 0 | ||
|
||
# include browsers we are committed to support | ||
last 1 Chrome version | ||
last 1 Firefox version | ||
last 1 Edge version | ||
last 1 Safari version |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,15 @@ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
# https://git-scm.com/docs/gitignore | ||
|
||
# dependencies | ||
/node_modules | ||
# files generated by package manager | ||
/node_modules/ | ||
/yarn-debug.log | ||
/yarn-error.log | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/dist | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
.idea | ||
# build artifacts and other generated files | ||
/dist/ | ||
/coverage/ | ||
/cosmos/ | ||
|
||
# editor files | ||
/.idea/ | ||
/.vscode/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
language: node_js | ||
node_js: | ||
- '10' | ||
- 'lts/*' | ||
cache: yarn | ||
before_install: | ||
- curl -o- -L https://yarnpkg.com/install.sh | bash | ||
- export PATH="$HOME/.yarn/bin:$PATH" | ||
- yarn install | ||
script: | ||
- yarn test | ||
- yarn coveralls | ||
- yarn dist | ||
|
||
- yarn build | ||
- yarn coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// https://babeljs.io/docs/en/next/options | ||
|
||
module.exports = { | ||
presets: ['@babel/preset-env', '@babel/preset-react'], | ||
plugins: ['@babel/plugin-proposal-class-properties'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// https://github.com/react-cosmos/react-cosmos#config | ||
|
||
const paths = require('./paths'); | ||
|
||
module.exports = { | ||
rootPath: paths.projectRoot, | ||
|
||
// by convention, all fixtures use the '.fixture.js' suffix | ||
fileMatch: '**/*.fixture.js', | ||
|
||
// additional modules to load along with every component | ||
globalImports: ['@babel/polyfill'], | ||
|
||
// path to Cosmos proxies | ||
proxiesPath: `${paths.src}/cosmos/proxies.js`, | ||
|
||
// webpack server settings | ||
webpackConfigPath: `${paths.config}/cosmos.webpack.config.js`, | ||
watchDirs: [paths.src], | ||
port: 9000, | ||
|
||
// directory where cosmos-export tool generates the static application | ||
outputPath: paths.cosmosExport | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// https://webpack.js.org/configuration/ | ||
|
||
const chalk = require('chalk'); | ||
const paths = require('./paths'); | ||
const babelOptions = require('./babel.config'); | ||
|
||
const webpackMode = process.env.NODE_ENV === 'production' ? 'production' : 'development'; | ||
console.log(chalk`Running webpack in {white ${webpackMode}} mode.`); | ||
|
||
module.exports = { | ||
mode: webpackMode, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
include: paths.src, | ||
loader: 'babel-loader', | ||
options: babelOptions | ||
} | ||
] | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// https://eslint.org/docs/user-guide/configuring | ||
// This configuration covers code meant to execute in browser or browser-like environment. | ||
|
||
const chalk = require('chalk'); | ||
const paths = require('./paths'); | ||
const pkg = require(paths.packageJson); | ||
|
||
// resolve React version for use with eslint-plugin-react | ||
const reactVersion = /^\D*(\d+).*$/.exec(pkg.peerDependencies.react)[1]; | ||
console.log(chalk`Using React {white ${reactVersion}} linting rules.`); | ||
|
||
const commonRules = require('./eslint.rules.common'); | ||
const reactRules = require('./eslint.rules.react'); | ||
|
||
module.exports = { | ||
extends: [ | ||
'standard', | ||
'standard-react', | ||
'airbnb', | ||
'plugin:import/errors', | ||
'plugin:import/warnings', | ||
'plugin:promise/recommended', | ||
'plugin:jest/recommended', | ||
// Prettier configuration comes last | ||
'plugin:prettier/recommended', | ||
'prettier/react', | ||
'prettier/standard' | ||
], | ||
|
||
env: { | ||
es6: true, | ||
browser: true, | ||
jest: true | ||
}, | ||
|
||
// use babel-eslint parser to ensure parity with Babel-supported syntax | ||
parser: 'babel-eslint', | ||
|
||
settings: { | ||
react: { | ||
version: reactVersion | ||
} | ||
}, | ||
|
||
rules: { | ||
...commonRules, | ||
...reactRules, | ||
'react/destructuring-assignment': [ | ||
'error', | ||
{ | ||
ignoreClassFields: true | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// https://eslint.org/docs/user-guide/configuring | ||
// This configuration covers code meant to execute in Node.js environment. | ||
|
||
const commonRules = require('./eslint.rules.common'); | ||
|
||
module.exports = { | ||
extends: [ | ||
'standard', | ||
'airbnb', | ||
'plugin:node/recommended', | ||
'plugin:jest/recommended', | ||
// Prettier configuration comes last | ||
'plugin:prettier/recommended', | ||
'prettier/standard' | ||
], | ||
|
||
env: { | ||
es6: true, | ||
node: true, | ||
jest: true | ||
}, | ||
|
||
parserOptions: { | ||
// Node.js loads scripts as CommonJS modules | ||
sourceType: 'script' | ||
}, | ||
|
||
rules: { | ||
...commonRules, | ||
'no-console': 'off', | ||
'global-require': 'off', | ||
'import/no-dynamic-require': 'off', | ||
'import/newline-after-import': 'off' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Common ESLint rule configuration extracted from patternfly-react/recommended. | ||
|
||
module.exports = { | ||
'import/no-extraneous-dependencies': [ | ||
'error', | ||
{ | ||
devDependencies: true | ||
} | ||
], | ||
'import/no-named-default': 'off', | ||
'import/prefer-default-export': 'off', | ||
'no-param-reassign': 'off', | ||
'no-plusplus': 'off', | ||
'no-prototype-builtins': 'off', | ||
'no-restricted-syntax': 'off', | ||
'no-underscore-dangle': 'off', | ||
'no-unused-expressions': [ | ||
'error', | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true | ||
} | ||
], | ||
'no-unused-vars': [ | ||
'error', | ||
{ | ||
vars: 'all', | ||
args: 'none', | ||
ignoreRestSiblings: true | ||
} | ||
], | ||
'no-use-before-define': 'off' | ||
}; |
Oops, something went wrong.