Skip to content

Commit

Permalink
first open source commit, I had to remove history, because there were…
Browse files Browse the repository at this point in the history
… passwords in it
  • Loading branch information
ndelangen committed Aug 28, 2019
1 parent cb3dd14 commit fb07c93
Show file tree
Hide file tree
Showing 61 changed files with 15,697 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .babelrc.js
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',
],
}
},
}
26 changes: 26 additions & 0 deletions .circleci/config.yml
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
12 changes: 12 additions & 0 deletions .env.example
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

2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
160 changes: 160 additions & 0 deletions .eslintrc.js
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
},
};
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TRUE-README.md
*.stories.*
*.test.*
webpack.config.babel.js
.*
10 changes: 10 additions & 0 deletions .storybook/config.js
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);
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deepscan.enable": true
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Storybook Chromatic

This document is TODO
29 changes: 29 additions & 0 deletions bin/__tests__/getStorybookConfiguration.test.js
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');
});
});
Loading

0 comments on commit fb07c93

Please sign in to comment.