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 trim_trailing_whitespace = false
[*.json] [*.json]
indent_size = 2
trim_trailing_whitespace = false trim_trailing_whitespace = false
insert_final_newline = false insert_final_newline = false
[*.js]
indent_size = 2

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,37 +1,37 @@
{ {
"name": "com.mambojambostudios.unity-atoms", "name": "com.mambojambostudios.unity-atoms",
"displayName": "Unity Atoms", "displayName": "Unity Atoms",
"version": "2.0.0", "version": "2.0.0",
"publishConfig": { "publishConfig": {
"registry": "https://npm.pkg.github.com/" "registry": "https://npm.pkg.github.com/"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/AdamRamberg/unity-atoms.git" "url": "git+https://github.com/AdamRamberg/unity-atoms.git"
}, },
"unity": "2019.1", "unity": "2019.1",
"description": "Tiny modular pieces utilizing the power of Scriptable Objects", "description": "Tiny modular pieces utilizing the power of Scriptable Objects",
"keywords": [ "keywords": [
"scriptable objects", "scriptable objects",
"unity" "unity"
], ],
"category": "Unity", "category": "Unity",
"scripts": { "scripts": {
"publish:all": "npm run publish:core && npm run publish:mobile && npm run publish:scene && npm run publish:tags && npm run publish:ui", "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:core": "npm publish ./Packages/Core --tag beta",
"publish:mobile": "npm publish ./Packages/Mobile --tag beta", "publish:mobile": "npm publish ./Packages/Mobile --tag beta",
"publish:scene": "npm publish ./Packages/SceneMgmt --tag beta", "publish:scene": "npm publish ./Packages/SceneMgmt --tag beta",
"publish:tags": "npm publish ./Packages/Tags --tag beta", "publish:tags": "npm publish ./Packages/Tags --tag beta",
"publish:ui": "npm publish ./Packages/UI --tag beta" "publish:ui": "npm publish ./Packages/UI --tag beta"
}, },
"files": [ "files": [
"/LICENSE.md", "/LICENSE.md",
"/LICENSE.md.meta", "/LICENSE.md.meta",
"/README.md", "/README.md",
"/README.md.meta", "/README.md.meta",
"/package.json", "/package.json",
"/package.json.meta", "/package.json.meta",
"/Packages", "/Packages",
"/Packages.meta" "/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" "rename-version": "docusaurus-rename-version"
}, },
"devDependencies": { "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. * Copyright (c) 2017-present, Facebook, Inc.
* *
@ -5,136 +6,131 @@
* LICENSE file in the root directory of this source tree. * 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) { function docUrl(doc, language) {
return `${siteConfig.baseUrl}${language ? `${language}/` : ""}${doc}`; return `${siteConfig.baseUrl}${language ? `${language}/` : ''}${doc}`;
} }
function imgUrl(img) { function imgUrl(img) {
return `${siteConfig.baseUrl}img/${img}`; return `${siteConfig.baseUrl}img/${img}`;
} }
class Button extends React.Component { const Button = ({ href, target, children }) => (
render() { <div className="pluginWrapper buttonWrapper">
return ( <a className="button hero" href={href} target={target}>
<div className="pluginWrapper buttonWrapper"> {children}
<a className="button hero" href={this.props.href} target={this.props.target}> </a>
{this.props.children} </div>
</a> );
</div>
);
}
}
Button.defaultProps = { Button.defaultProps = {
target: "_self" target: '_self',
}; };
const SplashContainer = props => ( const SplashContainer = ({ children }) => (
<div className="homeContainer"> <div className="homeContainer">
<div className="homeSplashFade"> <div className="homeSplashFade">
<div className="wrapper homeWrapper">{props.children}</div> <div className="wrapper homeWrapper">{children}</div>
</div> </div>
</div> </div>
); );
const ProjectTitle = () => ( const ProjectTitle = () => (
<React.Fragment> <React.Fragment>
<div style={{display : "flex", justifyContent : "center", alignItems : "center"}}> <div
<img src={"img/atom-icon-pure-purple.png"} className="homeLogo" alt="Unity Atoms logo" width={82} height={82} style={{ marginRight: '0.5rem' }}/> 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> <h1 className="projectTitle">{siteConfig.title}</h1>
</div> </div>
<h2 style={{marginTop : "0.5em"}}> <h2 style={{ marginTop: '0.5em' }}>
Tiny modular pieces utilizing the power of Scriptable Objects Tiny modular pieces utilizing the power of Scriptable Objects
</h2> </h2>
</React.Fragment> </React.Fragment>
); );
const PromoSection = props => ( const PromoSection = ({ children }) => (
<div className="section promoSection"> <div className="section promoSection">
<div className="promoRow"> <div className="promoRow">
<div className="pluginRowBlock">{props.children}</div> <div className="pluginRowBlock">{children}</div>
</div> </div>
</div> </div>
); );
class HomeSplash extends React.Component { const HomeSplash = ({ language = '' }) => (
render() { <SplashContainer>
const language = this.props.language || ""; <div className="inner">
return ( <ProjectTitle />
<SplashContainer> <PromoSection>
<div className="inner"> <Button href={docUrl('introduction/quick-start', language)}>
<ProjectTitle /> Get Started
<PromoSection> </Button>
<Button href={docUrl("introduction/quick-start", language)}> </PromoSection>
Get Started </div>
</Button> </SplashContainer>
</PromoSection> );
</div>
</SplashContainer>
);
}
}
const Block = props => ( const Block = ({ id, background, className, children, layout }) => (
<Container <Container id={id} background={background} className={className}>
id={props.id} <GridBlock align="center" contents={children} layout={layout} />
background={props.background}
className={props.className}
>
<GridBlock align="center" contents={props.children} layout={props.layout}/>
</Container> </Container>
); );
const FeaturesTop = props => ( const FeaturesTop = () => (
<Block layout="threeColumn" className="featureBlock"> <Block layout="threeColumn" className="featureBlock">
{[ {[
{ {
content: "Avoid scripts and systems directly dependent on each other.", content: 'Avoid scripts and systems directly dependent on each other.',
image : imgUrl("box.svg"), image: imgUrl('box.svg'),
imageAlign: 'top', imageAlign: 'top',
title: "Modular" title: 'Modular',
}, },
{ {
content: "Scriptable Objects makes it possible to make changes to your game at runtime.", content:
image : imgUrl("pen.svg"), 'Scriptable Objects makes it possible to make changes to your game at runtime.',
image: imgUrl('pen.svg'),
imageAlign: 'top', imageAlign: 'top',
title: "Editable" title: 'Editable',
}, },
{ {
content: "Modular code is easier to debug than tightly coupled code.", content: 'Modular code is easier to debug than tightly coupled code.',
image : imgUrl("bug.svg"), image: imgUrl('bug.svg'),
imageAlign: 'top', imageAlign: 'top',
title: "Debuggable" title: 'Debuggable',
}, },
]} ]}
</Block> </Block>
); );
const Index = ({ language = '' }) => (
class Index extends React.Component { <div className="homeMainWrapper">
render() { <HomeSplash language={language} />
const language = this.props.language || ""; <Container background="light">
<div style={{ paddingTop: '3rem', paddingBottom: '3rem' }}>
return ( <FeaturesTop />
<div className="homeMainWrapper">
<HomeSplash language={language} />
<Container background="light">
<div style={{ paddingTop: '3rem', paddingBottom: '3rem' }}>
<FeaturesTop />
</div>
</Container>
</div> </div>
); </Container>
} </div>
} );
module.exports = Index; 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": { "docs": {
"Introduction": [ "Introduction": [
"introduction/quick-start", "introduction/quick-start",
"introduction/overview", "introduction/overview",
"introduction/basic-tutorial", "introduction/basic-tutorial",
"introduction/generator", "introduction/generator",
"introduction/unirx" "introduction/unirx"
], ],
"API Reference": [ "API Reference": [
"api/actions", "api/actions",
"api/constants", "api/constants",
"api/events", "api/events",
"api/functions", "api/functions",
"api/listeners", "api/listeners",
"api/lists", "api/lists",
"api/references", "api/references",
"api/unity-events", "api/unity-events",
"api/variables" "api/variables"
], ],
"Subpackages": [ "Subpackages": [
"subpackages/mobile", "subpackages/mobile",
"subpackages/scene-mgmt", "subpackages/scene-mgmt",
"subpackages/tags", "subpackages/tags",
"subpackages/ui" "subpackages/ui"
] ]
} }
} }

View File

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

File diff suppressed because it is too large Load Diff