Skip to content

Commit

Permalink
Merge 9f390c9 into 2eb57a8
Browse files Browse the repository at this point in the history
  • Loading branch information
patw0929 committed Dec 8, 2018
2 parents 2eb57a8 + 9f390c9 commit b6dcbad
Show file tree
Hide file tree
Showing 38 changed files with 24,611 additions and 5,170 deletions.
15 changes: 15 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-dynamic-import"
],
"env": {
"test": {
"plugins": ["dynamic-import-node"]
}
}
}
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
build/**
dist/**
example/**
test/**
src/libphonenumber.js
node_modules/*
eslintrc.js
package.json
webpack.*.js
coverage/*
165 changes: 87 additions & 78 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,104 +1,113 @@
module.exports = {
'extends': 'eslint-config-airbnb',
'parser': 'babel-eslint',
'env': {
'browser': true,
'node': true,
'es6': true,
'jest': true
extends: ['eslint-config-airbnb', 'prettier'],
parser: 'babel-eslint',
env: {
browser: true,
node: true,
es6: true,
jest: true,
},
'ecmaFeatures': {
'jsx': true
},
'rules': {
rules: {
'prefer-destructuring': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/no-noninteractive-element-interactions': 'off',
'jsx-a11y/no-autofocus': 'off',
'jsx-a11y/no-noninteractive-tabindex': 'off',
'jsx-a11y/anchor-has-content': 'off',
'react/destructuring-assignment': 'off',
'react/jsx-no-bind': 'error',
'react/no-multi-comp': 'off',
'no-restricted-syntax': [
'error',
'DebuggerStatement',
'ForInStatement',
'WithStatement'
'WithStatement',
],
'newline-after-var': ['error', 'always'],
'newline-before-return': 'error',
'comma-dangle': ['error', 'always-multiline'], // https://github.com/airbnb/javascript/commit/788208295469e19b806c06e01095dc8ba1b6cdc9
'indent': ['error', 2, {'SwitchCase': 1}],
indent: ['error', 2, { SwitchCase: 1 }],
'no-console': 0,
'no-alert': 0,
'no-underscore-dangle': 'off',
'max-len': [ 'error', 150, 2, { 'ignoreUrls': true, 'ignoreComments': false, } ],
'max-len': ['error', 150, 2, { ignoreUrls: true, ignoreComments: false }],
'react/require-default-props': 'off',
'react/jsx-curly-spacing': [ 'error', 'always', { 'allowMultiline': true } ],
'react/jsx-curly-spacing': 'off',
'arrow-body-style': 'off',
'no-mixed-operators': ['error', {
'groups': [
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof']
],
'allowSamePrecedence': true
} ],
'react/jsx-filename-extension': ['error', { 'extensions': ['.js', '.jsx'] }],
'no-mixed-operators': [
'error',
{
groups: [
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
allowSamePrecedence: true,
},
],
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx'] }],
'react/no-string-refs': 'off',
'arrow-parens': ['error', 'always'],
'arrow-parens': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'react/prefer-stateless-function': 'off',
'no-param-reassign': 'off',
'no-unused-vars': ['error', { 'ignoreRestSiblings': true }],
'import/no-unresolved': [2, { ignore: ['react', 'react-dom', 'react-intl-tel-input'] }],
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
'import/no-unresolved': [
2,
{ ignore: ['react', 'react-dom', 'react-intl-tel-input'] },
],
'import/extensions': 'off',
'import/no-extraneous-dependencies': ['error', {
devDependencies: [
'test/**', // tape, common npm pattern
'tests/**', // also common npm pattern
'spec/**', // mocha, rspec-like pattern
'**/__tests__/**', // jest pattern
'**/__mocks__/**', // jest pattern
'test.js', // repos with a single test file
'test-*.js', // repos with multiple top-level test files
'**/*.test.js', // tests where the extension denotes that it is a test
'**/webpack.config.js', // webpack config
'**/webpack.config.*.js', // webpack config
'**/rollup.config.js', // rollup config
'**/gulpfile.js', // gulp config
'**/gulpfile.*.js', // gulp config
'**/Gruntfile', // grunt config
'config/jest/**',
'src/testUtils/**',
'*.js'
],
optionalDependencies: false,
}],
indent: ['error', 2, {
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
MemberExpression: 1,
// CallExpression: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'test/**', // tape, common npm pattern
'tests/**', // also common npm pattern
'spec/**', // mocha, rspec-like pattern
'**/__tests__/**', // jest pattern
'**/__mocks__/**', // jest pattern
'test.js', // repos with a single test file
'test-*.js', // repos with multiple top-level test files
'**/*.test.js', // tests where the extension denotes that it is a test
'**/webpack.config.js', // webpack config
'**/webpack.config.*.js', // webpack config
'config/jest/**',
'src/testUtils/**',
'*.js',
],
optionalDependencies: false,
},
],
indent: [
'error',
2,
{
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
MemberExpression: 1,
// CallExpression: {
// parameters: null,
// },
FunctionDeclaration: {
parameters: 1,
body: 1
// },
FunctionDeclaration: {
parameters: 1,
body: 1,
},
FunctionExpression: {
parameters: 1,
body: 1,
},
},
FunctionExpression: {
parameters: 1,
body: 1
}
}],
'no-plusplus': ['error', { "allowForLoopAfterthoughts": true }]
],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
},
plugins: ['react', 'import', 'security'],
globals: {
__DEVELOPMENT__: true,
__CLIENT__: true,
__SERVER__: true,
__DISABLE_SSR__: true,
__DEVTOOLS__: true,
},
'plugins': [
'react',
'import',
'security'
],
'globals': {
'__DEVELOPMENT__': true,
'__CLIENT__': true,
'__SERVER__': true,
'__DISABLE_SSR__': true,
'__DEVTOOLS__': true,
}
};
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cache:
directories:
- node_modules
node_js:
- "8.9.1"
- "8.10.0"
script:
- yarn test
- yarn lint
Expand Down
45 changes: 0 additions & 45 deletions config/babel.dev.js

This file was deleted.

42 changes: 0 additions & 42 deletions config/babel.prod.js

This file was deleted.

35 changes: 17 additions & 18 deletions config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,30 @@ var REACT_APP = /^REACT_APP_/i;

function getClientEnvironment(publicUrl) {
var NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'development');

// cnyes customized. to align other projects, defining same variables as other projects.
var DEVELOPMENT = NODE_ENV === JSON.stringify('development');
var SERVER = false;
var CLIENT = true;
var BUILD_NAME = JSON.stringify(process.env.BUILD_NAME || 'dev');

var processEnv = Object
.keys(process.env)
var processEnv = Object.keys(process.env)
.filter(key => REACT_APP.test(key))
.reduce((env, key) => {
env[key] = JSON.stringify(process.env[key]); // eslint-disable-line no-param-reassign
.reduce(
(env, key) => {
env[key] = JSON.stringify(process.env[key]); // eslint-disable-line no-param-reassign

return env;
}, {
// Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
'NODE_ENV': NODE_ENV,
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
'PUBLIC_URL': JSON.stringify(publicUrl),
'BUILD_NAME': BUILD_NAME,
});
return env;
}, {
// Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
NODE_ENV: NODE_ENV,
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
PUBLIC_URL: JSON.stringify(publicUrl),
BUILD_NAME: BUILD_NAME,
}
);

return {
'process.env': processEnv,
Expand Down
3 changes: 2 additions & 1 deletion config/jest/cssTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module.exports = {
module.exports = idObj;
`;
},
getCacheKey(fileData, filename) { // eslint-disable-line no-unused-vars
getCacheKey() {
// eslint-disable-line no-unused-vars
// The output is always the same.
return 'cssTransform';
},
Expand Down
1 change: 1 addition & 0 deletions config/jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import jsdom from 'jsdom';
import sinon from 'sinon';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import '@babel/polyfill';

Enzyme.configure({ adapter: new Adapter() });

Expand Down
1 change: 0 additions & 1 deletion config/jest/setupTestFramework.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ if (process.env.CI) {

jasmine.getEnv().addReporter(junitReporter);
}

3 changes: 1 addition & 2 deletions config/jest/transform.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const babelDev = require('../babel.dev');
const babelJest = require('babel-jest');

module.exports = babelJest.createTransformer(babelDev);
module.exports = babelJest.createTransformer();
Loading

0 comments on commit b6dcbad

Please sign in to comment.