Added eslint + prettier and updated .editorconfig

This commit is contained in:
AdamRamberg 2019-10-07 20:47:30 +02:00
parent 01fdf45a4b
commit 0b683448fb
17 changed files with 10731 additions and 6964 deletions

View File

@ -15,5 +15,9 @@ csharp_new_line_before_open_brace = all
trim_trailing_whitespace = false
[*.json]
indent_size = 2
trim_trailing_whitespace = false
insert_final_newline = false
[*.js]
indent_size = 2

View File

@ -1,28 +1,28 @@
{
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "file:../../Packages/Core",
"com.mambojambostudios.unity-atoms-mobile": "file:../../Packages/Mobile",
"com.mambojambostudios.unity-atoms-scene-mgmt": "file:../../Packages/SceneMgmt",
"com.mambojambostudios.unity-atoms-tags": "file:../../Packages/Tags",
"com.mambojambostudios.unity-atoms-ui": "file:../../Packages/UI",
"com.unity.package-manager-ui": "2.1.2",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0"
},
"testables": [
"com.mambojambostudios.unity-atoms-core",
"com.mambojambostudios.unity-atoms-mobile",
"com.mambojambostudios.unity-atoms-scene-mgmt",
"com.mambojambostudios.unity-atoms-tags",
"com.mambojambostudios.unity-atoms-ui"
]
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "file:../../Packages/Core",
"com.mambojambostudios.unity-atoms-mobile": "file:../../Packages/Mobile",
"com.mambojambostudios.unity-atoms-scene-mgmt": "file:../../Packages/SceneMgmt",
"com.mambojambostudios.unity-atoms-tags": "file:../../Packages/Tags",
"com.mambojambostudios.unity-atoms-ui": "file:../../Packages/UI",
"com.unity.package-manager-ui": "2.1.2",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0"
},
"testables": [
"com.mambojambostudios.unity-atoms-core",
"com.mambojambostudios.unity-atoms-mobile",
"com.mambojambostudios.unity-atoms-scene-mgmt",
"com.mambojambostudios.unity-atoms-tags",
"com.mambojambostudios.unity-atoms-ui"
]
}

View File

@ -1,24 +1,24 @@
{
"name": "com.mambojambostudios.unity-atoms-core",
"displayName": "Unity Atoms Core",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "Tiny modular pieces utilizing the power of Scriptable Objects",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta",
"/Runtime/MamboJamboStudios.UnityAtomsCore.Runtime.asmdef",
"/Runtime/MamboJamboStudios.UnityAtomsCore.Runtime.asmdef.meta",
"/Editor",
"/Editor.meta",
"/Editor/MamboJamboStudios.UnityAtomsCore.Editor.asmdef",
"/Editor/MamboJamboStudios.UnityAtomsCore.Editor.asmdef.meta"
]
"name": "com.mambojambostudios.unity-atoms-core",
"displayName": "Unity Atoms Core",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "Tiny modular pieces utilizing the power of Scriptable Objects",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta",
"/Runtime/MamboJamboStudios.UnityAtomsCore.Runtime.asmdef",
"/Runtime/MamboJamboStudios.UnityAtomsCore.Runtime.asmdef.meta",
"/Editor",
"/Editor.meta",
"/Editor/MamboJamboStudios.UnityAtomsCore.Editor.asmdef",
"/Editor/MamboJamboStudios.UnityAtomsCore.Editor.asmdef.meta"
]
}

View File

@ -1,23 +1,23 @@
{
"name": "com.mambojambostudios.unity-atoms-mobile",
"displayName": "Unity Atoms Mobile",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "Unity Atoms for your mobile project.",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta",
"/Editor",
"/Editor.meta"
],
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "2.0.0-beta.0"
}
"name": "com.mambojambostudios.unity-atoms-mobile",
"displayName": "Unity Atoms Mobile",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "Unity Atoms for your mobile project.",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta",
"/Editor",
"/Editor.meta"
],
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "2.0.0-beta.0"
}
}

View File

@ -1,23 +1,23 @@
{
"name": "com.mambojambostudios.unity-atoms-scene-mgmt",
"displayName": "Unity Atoms Scene Mgmt",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "Unity Atoms to manage your scenes.",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta",
"/Editor",
"/Editor.meta"
],
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "2.0.0-beta.0"
}
"name": "com.mambojambostudios.unity-atoms-scene-mgmt",
"displayName": "Unity Atoms Scene Mgmt",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "Unity Atoms to manage your scenes.",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta",
"/Editor",
"/Editor.meta"
],
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "2.0.0-beta.0"
}
}

View File

@ -1,21 +1,21 @@
{
"name": "com.mambojambostudios.unity-atoms-tags",
"displayName": "Unity Atoms Tags",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "A replacement to Unity´s tags based on Unity Atoms.",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta"
],
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "2.0.0-beta.0"
}
"name": "com.mambojambostudios.unity-atoms-tags",
"displayName": "Unity Atoms Tags",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "A replacement to Unity´s tags based on Unity Atoms.",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta"
],
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "2.0.0-beta.0"
}
}

View File

@ -1,21 +1,21 @@
{
"name": "com.mambojambostudios.unity-atoms-ui",
"displayName": "Unity Atoms UI",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "UI system using Unity Atoms.",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta"
],
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "2.0.0-beta.0"
}
"name": "com.mambojambostudios.unity-atoms-ui",
"displayName": "Unity Atoms UI",
"version": "2.0.0-beta.0",
"unity": "2019.1",
"description": "UI system using Unity Atoms.",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"files": [
"/package.json",
"/package.json.meta",
"/Runtime",
"/Runtime.meta"
],
"dependencies": {
"com.mambojambostudios.unity-atoms-core": "2.0.0-beta.0"
}
}

View File

@ -3,4 +3,4 @@
"TabSize": 4,
"IndentationSize": 4
}
}
}

View File

@ -1,37 +1,37 @@
{
"name": "com.mambojambostudios.unity-atoms",
"displayName": "Unity Atoms",
"version": "2.0.0",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/AdamRamberg/unity-atoms.git"
},
"unity": "2019.1",
"description": "Tiny modular pieces utilizing the power of Scriptable Objects",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"scripts": {
"publish:all": "npm run publish:core && npm run publish:mobile && npm run publish:scene && npm run publish:tags && npm run publish:ui",
"publish:core": "npm publish ./Packages/Core --tag beta",
"publish:mobile": "npm publish ./Packages/Mobile --tag beta",
"publish:scene": "npm publish ./Packages/SceneMgmt --tag beta",
"publish:tags": "npm publish ./Packages/Tags --tag beta",
"publish:ui": "npm publish ./Packages/UI --tag beta"
},
"files": [
"/LICENSE.md",
"/LICENSE.md.meta",
"/README.md",
"/README.md.meta",
"/package.json",
"/package.json.meta",
"/Packages",
"/Packages.meta"
]
"name": "com.mambojambostudios.unity-atoms",
"displayName": "Unity Atoms",
"version": "2.0.0",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/AdamRamberg/unity-atoms.git"
},
"unity": "2019.1",
"description": "Tiny modular pieces utilizing the power of Scriptable Objects",
"keywords": [
"scriptable objects",
"unity"
],
"category": "Unity",
"scripts": {
"publish:all": "npm run publish:core && npm run publish:mobile && npm run publish:scene && npm run publish:tags && npm run publish:ui",
"publish:core": "npm publish ./Packages/Core --tag beta",
"publish:mobile": "npm publish ./Packages/Mobile --tag beta",
"publish:scene": "npm publish ./Packages/SceneMgmt --tag beta",
"publish:tags": "npm publish ./Packages/Tags --tag beta",
"publish:ui": "npm publish ./Packages/UI --tag beta"
},
"files": [
"/LICENSE.md",
"/LICENSE.md.meta",
"/README.md",
"/README.md.meta",
"/package.json",
"/package.json.meta",
"/Packages",
"/Packages.meta"
]
}

63
website/.eslintrc.js Normal file
View File

@ -0,0 +1,63 @@
const prettierOptions = require('./prettier.config');
module.exports = {
parser: 'babel-eslint',
extends: ['airbnb', 'prettier', 'prettier/react'],
plugins: ['prettier', 'react', 'jsx-a11y'],
env: {
browser: true,
node: true,
jest: true,
es6: true,
},
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
rules: {
'prettier/prettier': ['error', prettierOptions],
'arrow-body-style': [2, 'as-needed'],
'class-methods-use-this': 0,
'import/imports-first': 0,
'import/newline-after-import': 0,
'import/no-dynamic-require': 0,
'import/no-extraneous-dependencies': 0,
'import/no-named-as-default': 0,
'import/no-unresolved': 2,
'import/no-webpack-loader-syntax': 0,
'import/prefer-default-export': 0,
indent: [
2,
2,
{
SwitchCase: 1
},
],
'jsx-a11y/aria-props': 2,
'jsx-a11y/heading-has-content': 0,
'jsx-a11y/label-has-for': 2,
'jsx-a11y/mouse-events-have-key-events': 2,
'jsx-a11y/role-has-required-aria-props': 2,
'jsx-a11y/role-supports-aria-props': 2,
'max-len': 0,
'newline-per-chained-call': 0,
'no-confusing-arrow': 0,
'no-console': 1,
'no-use-before-define': 0,
'prefer-template': 2,
'react/jsx-closing-tag-location': 0,
'react/forbid-prop-types': 0,
'react/jsx-first-prop-new-line': [2, 'multiline'],
'react/jsx-filename-extension': 0,
'react/jsx-no-target-blank': 0,
'react/require-default-props': 0,
'react/require-extension': 0,
'react/self-closing-comp': 0,
'react/sort-comp': 0,
'react/prop-types': 0,
'react/jsx-fragments': 0,
},
}

10379
website/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,15 @@
"rename-version": "docusaurus-rename-version"
},
"devDependencies": {
"docusaurus": "^1.13.0"
"babel-eslint": "^10.0.3",
"docusaurus": "^1.13.0",
"eslint": "^6.5.1",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.16.0",
"prettier": "^1.18.2"
}
}

View File

@ -1,3 +1,4 @@
/* eslint-disable max-classes-per-file */
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
@ -5,136 +6,131 @@
* LICENSE file in the root directory of this source tree.
*/
const React = require("react");
const React = require('react');
const CompLibrary = require("../../core/CompLibrary.js");
// eslint-disable-next-line import/no-unresolved
const CompLibrary = require('../../core/CompLibrary');
const {MarkdownBlock, GridBlock, Container} = CompLibrary; /* Used to read markdown */
const { GridBlock, Container } = CompLibrary; /* Used to read markdown */
const siteConfig = require(`${process.cwd()}/siteConfig.js`);
const siteConfig = require(`${process.cwd()}/siteConfig`);
function docUrl(doc, language) {
return `${siteConfig.baseUrl}${language ? `${language}/` : ""}${doc}`;
return `${siteConfig.baseUrl}${language ? `${language}/` : ''}${doc}`;
}
function imgUrl(img) {
return `${siteConfig.baseUrl}img/${img}`;
}
class Button extends React.Component {
render() {
return (
<div className="pluginWrapper buttonWrapper">
<a className="button hero" href={this.props.href} target={this.props.target}>
{this.props.children}
</a>
</div>
);
}
}
const Button = ({ href, target, children }) => (
<div className="pluginWrapper buttonWrapper">
<a className="button hero" href={href} target={target}>
{children}
</a>
</div>
);
Button.defaultProps = {
target: "_self"
target: '_self',
};
const SplashContainer = props => (
const SplashContainer = ({ children }) => (
<div className="homeContainer">
<div className="homeSplashFade">
<div className="wrapper homeWrapper">{props.children}</div>
<div className="wrapper homeWrapper">{children}</div>
</div>
</div>
);
const ProjectTitle = () => (
<React.Fragment>
<div style={{display : "flex", justifyContent : "center", alignItems : "center"}}>
<img src={"img/atom-icon-pure-purple.png"} className="homeLogo" alt="Unity Atoms logo" width={82} height={82} style={{ marginRight: '0.5rem' }}/>
<div
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<img
src="img/atom-icon-pure-purple.png"
className="homeLogo"
alt="Unity Atoms logo"
width={82}
height={82}
style={{ marginRight: '0.5rem' }}
/>
<h1 className="projectTitle">{siteConfig.title}</h1>
</div>
<h2 style={{marginTop : "0.5em"}}>
Tiny modular pieces utilizing the power of Scriptable Objects
<h2 style={{ marginTop: '0.5em' }}>
Tiny modular pieces utilizing the power of Scriptable Objects
</h2>
</React.Fragment>
</React.Fragment>
);
const PromoSection = props => (
const PromoSection = ({ children }) => (
<div className="section promoSection">
<div className="promoRow">
<div className="pluginRowBlock">{props.children}</div>
<div className="pluginRowBlock">{children}</div>
</div>
</div>
);
class HomeSplash extends React.Component {
render() {
const language = this.props.language || "";
return (
<SplashContainer>
<div className="inner">
<ProjectTitle />
<PromoSection>
<Button href={docUrl("introduction/quick-start", language)}>
Get Started
</Button>
</PromoSection>
</div>
</SplashContainer>
);
}
}
const HomeSplash = ({ language = '' }) => (
<SplashContainer>
<div className="inner">
<ProjectTitle />
<PromoSection>
<Button href={docUrl('introduction/quick-start', language)}>
Get Started
</Button>
</PromoSection>
</div>
</SplashContainer>
);
const Block = props => (
<Container
id={props.id}
background={props.background}
className={props.className}
>
<GridBlock align="center" contents={props.children} layout={props.layout}/>
const Block = ({ id, background, className, children, layout }) => (
<Container id={id} background={background} className={className}>
<GridBlock align="center" contents={children} layout={layout} />
</Container>
);
const FeaturesTop = props => (
const FeaturesTop = () => (
<Block layout="threeColumn" className="featureBlock">
{[
{
content: "Avoid scripts and systems directly dependent on each other.",
image : imgUrl("box.svg"),
content: 'Avoid scripts and systems directly dependent on each other.',
image: imgUrl('box.svg'),
imageAlign: 'top',
title: "Modular"
title: 'Modular',
},
{
content: "Scriptable Objects makes it possible to make changes to your game at runtime.",
image : imgUrl("pen.svg"),
content:
'Scriptable Objects makes it possible to make changes to your game at runtime.',
image: imgUrl('pen.svg'),
imageAlign: 'top',
title: "Editable"
title: 'Editable',
},
{
content: "Modular code is easier to debug than tightly coupled code.",
image : imgUrl("bug.svg"),
content: 'Modular code is easier to debug than tightly coupled code.',
image: imgUrl('bug.svg'),
imageAlign: 'top',
title: "Debuggable"
title: 'Debuggable',
},
]}
</Block>
);
class Index extends React.Component {
render() {
const language = this.props.language || "";
return (
<div className="homeMainWrapper">
<HomeSplash language={language} />
<Container background="light">
<div style={{ paddingTop: '3rem', paddingBottom: '3rem' }}>
<FeaturesTop />
</div>
</Container>
const Index = ({ language = '' }) => (
<div className="homeMainWrapper">
<HomeSplash language={language} />
<Container background="light">
<div style={{ paddingTop: '3rem', paddingBottom: '3rem' }}>
<FeaturesTop />
</div>
);
}
}
</Container>
</div>
);
module.exports = Index;

View File

@ -0,0 +1,6 @@
module.exports = {
printWidth: 80,
semi: true,
singleQuote: true,
trailingComma: 'all',
};

View File

@ -1,28 +1,28 @@
{
"docs": {
"Introduction": [
"introduction/quick-start",
"introduction/overview",
"introduction/basic-tutorial",
"introduction/generator",
"introduction/unirx"
],
"API Reference": [
"api/actions",
"api/constants",
"api/events",
"api/functions",
"api/listeners",
"api/lists",
"api/references",
"api/unity-events",
"api/variables"
],
"Subpackages": [
"subpackages/mobile",
"subpackages/scene-mgmt",
"subpackages/tags",
"subpackages/ui"
]
}
"docs": {
"Introduction": [
"introduction/quick-start",
"introduction/overview",
"introduction/basic-tutorial",
"introduction/generator",
"introduction/unirx"
],
"API Reference": [
"api/actions",
"api/constants",
"api/events",
"api/functions",
"api/listeners",
"api/lists",
"api/references",
"api/unity-events",
"api/variables"
],
"Subpackages": [
"subpackages/mobile",
"subpackages/scene-mgmt",
"subpackages/tags",
"subpackages/ui"
]
}
}

View File

@ -9,11 +9,11 @@
// site configuration options.
const siteConfig = {
title: 'Unity Atoms', // Title for your website.
tagline: 'Tiny modular pieces utilizing the power of Scriptable Objects',
url: 'https://adamramberg.github.io', // Your website URL
baseUrl: '/unity-atoms/',
docsUrl: '',
title: 'Unity Atoms', // Title for your website.
tagline: 'Tiny modular pieces utilizing the power of Scriptable Objects',
url: 'https://adamramberg.github.io', // Your website URL
baseUrl: '/unity-atoms/',
docsUrl: '',
// Used for publishing and more
projectName: 'unity-atoms',
@ -26,7 +26,7 @@ const siteConfig = {
headerLinks: [
{ doc: 'introduction/quick-start', label: 'Quick Start' },
{ doc: 'api/actions', label: 'API' },
{ href: 'https://www.github.com/AdamRamberg/unity-atoms', label: 'Github' }
{ href: 'https://www.github.com/AdamRamberg/unity-atoms', label: 'Github' },
],
/* path to images for header/footer */
@ -92,7 +92,7 @@ const siteConfig = {
// You may provide arbitrary config keys to be used as needed by your
// template. For example, if you need your repo's URL...
repoUrl: 'https://github.com/AdamRamberg/unity-atoms',
repoUrl: 'https://github.com/AdamRamberg/unity-atoms',
};
module.exports = siteConfig;

File diff suppressed because it is too large Load Diff