Ver código fonte

Merge branch 'init_atlas' into atlas-components-merge

Klaudiusz Dembler 4 anos atrás
pai
commit
958772fb0f

+ 3 - 0
.eslintignore

@@ -0,0 +1,3 @@
+node_modules
+dist
+packages/**/dist

+ 35 - 31
.eslintrc.js

@@ -1,32 +1,36 @@
 module.exports = {
-  env: {
-    browser: true,
-    es6: true,
-  },
-  globals: {
-    Atomics: "readonly",
-    SharedArrayBuffer: "readonly",
-  },
-  parser: "@typescript-eslint/parser",
-  parserOptions: {
-    ecmaFeatures: {
-      jsx: true,
-    },
-    ecmaVersion: 2019,
-    sourceType: "module",
-  },
-  extends: [
-    "plugin:react/recommended",
-    "standard",
-    "plugin:jsx-a11y/recommended",
-    "plugin:prettier/recommended",
-  ],
-  plugins: ["react", "react-hooks"],
-  rules: {
-    "react-hooks/rules-of-hooks": "error",
-    "react-hooks/exhaustive-deps": "warn",
-  },
-  settings: {
-    version: "detect",
-  },
-};
+	env: {
+		browser: true,
+		node: true,
+		es6: true,
+		jest: true,
+	},
+	globals: {
+		Atomics: 'readonly',
+		SharedArrayBuffer: 'readonly',
+	},
+	parser: '@typescript-eslint/parser',
+	parserOptions: {
+		ecmaFeatures: {
+			jsx: true,
+		},
+		ecmaVersion: 2019,
+		sourceType: 'module',
+	},
+	extends: [
+		'eslint:recommended',
+		'plugin:@typescript-eslint/recommended',
+		'plugin:react/recommended',
+		'plugin:react-hooks/recommended',
+		'plugin:prettier/recommended',
+	],
+	plugins: ['@typescript-eslint', 'react', 'react-hooks'],
+	rules: {
+		'react/prop-types': 'off',
+	},
+	settings: {
+		react: {
+			version: 'detect',
+		},
+	},
+}

+ 1 - 21
.gitignore

@@ -1,23 +1,3 @@
-
-# Logs
-logs
-*.log
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-
-# Coverage directory used by tools like istanbul
-coverage
-
-# nyc test coverage
-.nyc_output
-
-# Node Modules
-
-node_modules/
-
-
-
 # Secrets
 *.env*
 
@@ -80,7 +60,7 @@ typings/
 .cache/
 .now
 dist/
-
+storybook-static
 # Mac files
 .DS_Store
 

+ 2 - 2
.prettierrc

@@ -1,4 +1,4 @@
 {
-	"semi": true,
-	"trailingComma": "es5"
+	"semi": false,
+	"singleQuote": true
 }

+ 5 - 0
__mocks__/svgrMock.js

@@ -0,0 +1,5 @@
+import * as React from 'react'
+export default 'SvgrURL'
+const SvgrMock = React.forwardRef((props, ref) => <span ref={ref} {...props} />)
+SvgrMock.displayName = 'SvgrMock'
+export const ReactComponent = SvgrMock

+ 7 - 7
jest.config.js

@@ -21,7 +21,7 @@ module.exports = {
 	// collectCoverageFrom: undefined,
 
 	// The directory where Jest should output its coverage files
-	coverageDirectory: "coverage",
+	coverageDirectory: '.coverage',
 
 	// An array of regexp pattern strings used to skip coverage collection
 	// coveragePathIgnorePatterns: [
@@ -76,7 +76,9 @@ module.exports = {
 	// ],
 
 	// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
-	// moduleNameMapper: {},
+	moduleNameMapper: {
+		'\\.svg': '<rootDir>/__mocks__/svgrMock.js',
+	},
 
 	// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
 	// modulePathIgnorePatterns: [],
@@ -123,7 +125,7 @@ module.exports = {
 	// setupFiles: [],
 
 	// A list of paths to modules that run some code to configure or set up the testing framework before each test
-	setupFilesAfterEnv: ["<rootDir>/setupTests.js"],
+	setupFilesAfterEnv: ['<rootDir>/setupTests.js'],
 
 	// A list of paths to snapshot serializer modules Jest should use for snapshot testing
 	// snapshotSerializers: [],
@@ -167,9 +169,7 @@ module.exports = {
 	// transform: undefined,
 
 	// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
-	// transformIgnorePatterns: [
-	//   "/node_modules/"
-	// ],
+	transformIgnorePatterns: ['/node_modules/(?!@babel/runtime)'],
 
 	// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
 	// unmockedModulePathPatterns: undefined,
@@ -182,4 +182,4 @@ module.exports = {
 
 	// Whether to use watchman for file crawling
 	// watchman: true,
-};
+}

+ 4 - 2
package.json

@@ -9,12 +9,13 @@
 		"build": "lerna run build",
 		"dev": "lerna run --parallel dev",
 		"storybook": "lerna run --scope atlas-app --stream storybook",
+		"lint": "yarn run eslint . --ext .js,.jsx,.ts,.tsx",
 		"clean": "lerna clean && rm -rf node_modules",
 		"test": "jest"
 	},
 	"lint-staged": {
 		"*.{ts, tsx, js, jsx, json}": [
-			"prettier --no-semi --trailing-comma none --write"
+			"prettier --write"
 		]
 	},
 	"devDependencies": {
@@ -36,7 +37,7 @@
 		"@storybook/react": "^5.3.17",
 		"@storybook/theming": "^5.3.19",
 		"@svgr/webpack": "^5.4.0",
-		"@typescript-eslint/eslint-plugin": "^3.2.0",
+		"@typescript-eslint/eslint-plugin": "^3.5.0",
 		"@typescript-eslint/parser": "^3.2.0",
 		"babel-loader": "^8.0.6",
 		"concurrently": "^5.2.0",
@@ -47,6 +48,7 @@
 		"eslint-config-prettier": "^6.11.0",
 		"eslint-plugin-jsx-a11y": "^6.2.3",
 		"eslint-plugin-prettier": "^3.1.3",
+		"eslint-plugin-react": "^7.20.3",
 		"eslint-plugin-react-hooks": "^4.0.4",
 		"husky": "^4.2.5",
 		"jest": "^26.0.1",

+ 0 - 4
packages/app/src/shared/.storybook/main.js

@@ -43,10 +43,6 @@ module.exports = {
 			],
 		});
 		config.resolve.extensions.push(".ts", ".tsx");
-		config.resolve.alias = {
-			...config.resolve.alias,
-			components: path.resolve(__dirname, "../src", "components"),
-		};
 		return config;
 	},
 };

+ 2 - 67
packages/app/src/shared/__tests__/__snapshots__/Button.test.js.snap

@@ -1,70 +1,5 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`Button component Should render custom button correctly 1`] = `
-<Memo(Button)
-  color="success"
-  size="large"
->
-  <button
-    css={
-      Object {
-        "map": undefined,
-        "name": "nynpfd",
-        "next": undefined,
-        "styles": "
-    
-    padding: 1rem 0.5rem;
+exports[`Button component Should render custom button correctly 1`] = `ReactWrapper {}`;
 
-    font-size: 2rem;
-
-    width: auto;
-  ;
-    border-radius: 0.25rem;
-    border-color: ;
-    border-style: solid;
-    border-width: 2px;
-    font-style: 'Lato','Helvetica Neue',Arial,Helvetica,sans-serif;
-    background-color: #56BA46;
-    color: #fff;
-  ",
-        "toString": [Function],
-      }
-    }
-  >
-    Hello Atlas
-  </button>
-</Memo(Button)>
-`;
-
-exports[`Button component Should render default button correctly 1`] = `
-<Memo(Button)>
-  <button
-    css={
-      Object {
-        "map": undefined,
-        "name": "1s1uxvy",
-        "next": undefined,
-        "styles": "
-    
-    padding: 0.75rem 0.5rem;
-
-    font-size: 1rem;
-
-    width: auto;
-  ;
-    border-radius: 0.25rem;
-    border-color: ;
-    border-style: solid;
-    border-width: 2px;
-    font-style: 'Lato','Helvetica Neue',Arial,Helvetica,sans-serif;
-    background-color: #2578C2;
-    color: #fff;
-  ",
-        "toString": [Function],
-      }
-    }
-  >
-    Click me!
-  </button>
-</Memo(Button)>
-`;
+exports[`Button component Should render default button correctly 1`] = `ReactWrapper {}`;

Diferenças do arquivo suprimidas por serem muito extensas
+ 388 - 388
yarn.lock


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff