-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first open source commit, I had to remove history, because there were…
… passwords in it
- Loading branch information
Showing
61 changed files
with
15,697 additions
and
0 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,23 @@ | ||
module.exports = { | ||
env: { | ||
test: { | ||
presets: [ | ||
['@babel/preset-env', { targets: { node: 'current' } }], | ||
], | ||
plugins: [ | ||
'require-context-hook' | ||
], | ||
}, | ||
build: { | ||
comments: false, | ||
presets: [ | ||
'@babel/env', | ||
'minify', | ||
], | ||
plugins: [ | ||
'@babel/plugin-proposal-object-rest-spread', | ||
'@babel/transform-runtime', | ||
], | ||
} | ||
}, | ||
} |
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,26 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/node:8 | ||
|
||
working_directory: ~/repo | ||
|
||
steps: | ||
- checkout | ||
|
||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "yarn.lock" }} | ||
- v1-dependencies- | ||
|
||
- run: yarn install | ||
|
||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-{{ checksum "yarn.lock" }} | ||
|
||
- run: yarn test | ||
|
||
- run: yarn lint |
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,12 @@ | ||
# This is just an example file. | ||
# Rename this to `.env` and replace the app_code | ||
|
||
# If you need an app_code for local testing, we'll give you one for free: | ||
# [email protected] | ||
# Please do not share any app_code publicly. | ||
|
||
CHROMATIC_APP_CODE=<place app_code here> | ||
|
||
# CHROMATIC_INDEX_URL=https://www.chromaticqa.com | ||
# CHROMATIC_TUNNEL_URL=http://tunnel.chromaticqa.com | ||
|
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,2 @@ | ||
dist | ||
node_modules |
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,160 @@ | ||
const error = 2; | ||
const warn = 1; | ||
const ignore = 0; | ||
|
||
module.exports = { | ||
root: true, | ||
extends: [ | ||
'airbnb', | ||
'plugin:jest/recommended', | ||
'plugin:import/react-native', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'prettier/react', | ||
'prettier/@typescript-eslint', | ||
], | ||
plugins: [ | ||
'@typescript-eslint', | ||
'prettier', | ||
'jest', | ||
'import', | ||
'react', | ||
'jsx-a11y', | ||
'json', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 8, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
env: { es6: true, node: true, 'jest/globals': true }, | ||
settings: { | ||
'import/core-modules': ['enzyme'], | ||
'import/ignore': ['node_modules\\/(?!@storybook)'], | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.ts', '.tsx', '.mjs', '.d.ts'], | ||
paths: ['node_modules/', 'node_modules/@types/'], | ||
}, | ||
}, | ||
}, | ||
rules: { | ||
'no-useless-constructor': ignore, | ||
'@typescript-eslint/no-useless-constructor': error, | ||
'no-restricted-imports': [ | ||
error, | ||
{ | ||
paths: [ | ||
{ | ||
name: 'lodash.isequal', | ||
message: | ||
'Lodash modularised (and lodash < 4.17.11) have CVE vulnerabilities. Please use tree-shakeable imports like lodash/xxx instead', | ||
}, | ||
{ | ||
name: 'lodash.mergewith', | ||
message: | ||
'Lodash modularised (and lodash < 4.17.11) have CVE vulnerabilities. Please use tree-shakeable imports like lodash/xxx instead', | ||
}, | ||
{ | ||
name: 'lodash.pick', | ||
message: | ||
'Lodash modularised (and lodash < 4.17.11) have CVE vulnerabilities. Please use tree-shakeable imports like lodash/xxx instead', | ||
}, | ||
], | ||
// catch-all for any lodash modularised. The CVE is listed against the entire family for lodash < 4.17.11 | ||
patterns: ['lodash.*'], | ||
}, | ||
], | ||
'prettier/prettier': [warn], | ||
'no-debugger': process.env.NODE_ENV === 'production' ? error : ignore, | ||
'class-methods-use-this': ignore, | ||
'import/extensions': [ | ||
error, | ||
'always', | ||
{ | ||
js: 'never', | ||
ts: 'never', | ||
tsx: 'never', | ||
mjs: 'never', | ||
}, | ||
], | ||
'import/no-extraneous-dependencies': [ | ||
error, | ||
{ | ||
devDependencies: [ | ||
'examples/**', | ||
'examples-native/**', | ||
'**/example/**', | ||
'*.js', | ||
'**/*.test.js', | ||
'**/*.stories.*', | ||
'**/scripts/*.js', | ||
'**/stories/**/*.js', | ||
'**/__tests__/**/*.js', | ||
'**/.storybook/**/*.*', | ||
], | ||
peerDependencies: true, | ||
}, | ||
], | ||
'import/prefer-default-export': ignore, | ||
'import/default': error, | ||
'import/named': error, | ||
'import/namespace': error, | ||
'react/jsx-filename-extension': [ | ||
warn, | ||
{ | ||
extensions: ['.js', '.jsx', '.tsx'], | ||
}, | ||
], | ||
'react/jsx-no-bind': [ | ||
error, | ||
{ | ||
ignoreDOMComponents: true, | ||
ignoreRefs: true, | ||
allowArrowFunctions: true, | ||
allowFunctions: true, | ||
allowBind: true, | ||
}, | ||
], | ||
'jsx-a11y/accessible-emoji': ignore, | ||
'jsx-a11y/label-has-associated-control': [ | ||
warn, | ||
{ | ||
labelComponents: ['CustomInputLabel'], | ||
labelAttributes: ['label'], | ||
controlComponents: ['CustomInput'], | ||
depth: 3, | ||
}, | ||
], | ||
'react/no-unescaped-entities': ignore, | ||
'jsx-a11y/label-has-for': [error, { required: { some: ['nesting', 'id'] } }], | ||
'jsx-a11y/anchor-is-valid': [ | ||
error, | ||
{ | ||
components: ['A', 'LinkTo', 'Link'], | ||
specialLink: ['overrideParams', 'kind', 'story', 'to'], | ||
}, | ||
], | ||
'no-underscore-dangle': [ | ||
error, | ||
{ | ||
allow: [ | ||
'__STORYBOOK_CLIENT_API__', | ||
'__STORYBOOK_ADDONS_CHANNEL__', | ||
'__STORYBOOK_STORY_STORE__', | ||
], | ||
}, | ||
], | ||
'@typescript-eslint/no-var-requires': ignore, | ||
'@typescript-eslint/camelcase': ignore, | ||
'@typescript-eslint/no-unused-vars': ignore, | ||
'@typescript-eslint/explicit-member-accessibility': ignore, | ||
'@typescript-eslint/explicit-function-return-type': ignore, | ||
'@typescript-eslint/no-explicit-any': ignore, // would prefer to enable this | ||
'@typescript-eslint/no-use-before-define': ignore, // this is duplicated | ||
'@typescript-eslint/interface-name-prefix': ignore, // I don't agree | ||
}, | ||
}; |
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,5 @@ | ||
TRUE-README.md | ||
*.stories.* | ||
*.test.* | ||
webpack.config.babel.js | ||
.* |
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,10 @@ | ||
import { configure } from '@storybook/react'; | ||
|
||
import '../src/storybook-addon'; | ||
|
||
function loadStories() { | ||
const req = require.context('../stories/', true, /\.stories\.js$/); | ||
req.keys().forEach(filename => req(filename)); | ||
} | ||
|
||
configure(loadStories, module); |
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,3 @@ | ||
{ | ||
"deepscan.enable": 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,3 @@ | ||
# Storybook Chromatic | ||
|
||
This document is TODO |
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,29 @@ | ||
import { getStorybookConfiguration } from '../storybook/get-configuration'; | ||
|
||
describe('getStorybookConfiguration', () => { | ||
it('handles short names', () => { | ||
const port = getStorybookConfiguration('start-storybook -p 9001', '-p', '--port'); | ||
expect(port).toBe('9001'); | ||
}); | ||
it('handles long names', () => { | ||
const port = getStorybookConfiguration('start-storybook --port 9001', '-p', '--port'); | ||
expect(port).toBe('9001'); | ||
}); | ||
it('handles equals', () => { | ||
const port = getStorybookConfiguration('start-storybook --port=9001', '-p', '--port'); | ||
expect(port).toBe('9001'); | ||
}); | ||
it('handles double space', () => { | ||
const port = getStorybookConfiguration('start-storybook --port 9001', '-p', '--port'); | ||
expect(port).toBe('9001'); | ||
}); | ||
|
||
it('handles complex scripts', () => { | ||
const port = getStorybookConfiguration( | ||
"node verify-node-version.js && concurrently --raw --kill-others 'yarn relay --watch' 'start-storybook -s ./public -p 9001'", | ||
'-p', | ||
'--port' | ||
); | ||
expect(port).toBe('9001'); | ||
}); | ||
}); |
Oops, something went wrong.