Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Adding lint to travis #94

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
public/
webpack.config.js
src/scripts
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"env": {
"browser": true,
"node": true
}
}
}
26 changes: 16 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ node_js:
cache:
directories:
- node_modules
script:
- yarn run build

deploy:
provider: pages
skip_cleanup: true
github_token: $github_token
local_dir: public
fqdn: glossario.opendevufcg.org
on:
branch: master
jobs:
include:
- stage: lint
script: yarn run lint
- stage: build
script: yarn run build
- stage: deploy
script: skip
deploy:
provider: pages
skip_cleanup: true
github_token: $github_token
local_dir: public
fqdn: glossario.opendevufcg.org
on:
branch: master
5 changes: 5 additions & 0 deletions src/components/404/NotFound.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import ResultCard from '../ResultCard/ResultCard';

const notFoundCard = termo => ({
Expand All @@ -16,4 +17,8 @@ const NotFound = ({ termo }) => (
<ResultCard result={notFoundCard(termo)} />
);

NotFound.propTypes = {
termo: PropTypes.string,
};

export default NotFound;
2 changes: 1 addition & 1 deletion src/components/Footer/GlossaryFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import IconWithText from "../IconWithText/IconWithText"
const contributionLink = "https://github.com/OpenDevUFCG/glossario-ufcg/blob/master/CONTRIBUTING.md";
const aboutLink = "https://opendevufcg.org/";

const GlossaryFooter = (props) => (
const GlossaryFooter = () => (
<div className={'glossary-footer'}>
<a className={"pointer-hover no-decoration lighter-hover"} href={contributionLink}>
<IconWithText icon={"inbox"} text={"Como contribuir?"}/>
Expand Down
13 changes: 9 additions & 4 deletions src/components/Glossary/Glossary.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, {Component} from "react";
import "./Glossary.css"
import Search from "../search/Search";
import React, { Component } from "react";
import PropTypes from 'prop-types';
import { Link } from "react-router-dom";
import Search from "../search/Search";
import "./Glossary.css"

import glossarioLogo from '../../../assets/images/glossario-logo.svg';

Expand Down Expand Up @@ -38,4 +39,8 @@ class Glossary extends Component {
}
}

export default Glossary;
Glossary.propTypes = {
history: PropTypes.object,
};

export default Glossary;
15 changes: 11 additions & 4 deletions src/components/Icon/Icon.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import React from 'react';
import PropTypes from 'prop-types';

const Icon = (props) => (
<i className="material-icons" style={{color: props.iconColor, fontSize: props.size}}>
{props.icon}
const Icon = ({ icon, iconColor, size }) => (
<i className="material-icons" style={{color: iconColor, fontSize: size}}>
{icon}
</i>
);

export default Icon;
Icon.propTypes = {
iconColor: PropTypes.string,
size: PropTypes.string,
icon: PropTypes.any,
};

export default Icon;
13 changes: 10 additions & 3 deletions src/components/IconButton/IconButton.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import Icon from "../Icon/Icon";

const IconButton = (props) => (
<button className={'odu-icon-button align-self-center'} onClick={props.action}>
<Icon icon={props.icon} iconColor={props.iconColor}/>
const IconButton = ({ action, iconColor, icon }) => (
<button className={'odu-icon-button align-self-center'} onClick={action}>
<Icon icon={icon} iconColor={iconColor}/>
</button>
);

IconButton.propTypes = {
icon: PropTypes.any,
action: PropTypes.func,
iconColor: PropTypes.string,
};

export default IconButton;
16 changes: 11 additions & 5 deletions src/components/IconWithText/IconWithText.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import React from 'react';
import "./IconWithText.css"

import PropTypes from 'prop-types';
import Icon from "../Icon/Icon"

const IconWithText = (props) => (
import "./IconWithText.css"

const IconWithText = ({ icon, text }) => (
<div className={"icon-with-text light-accent"}>
<Icon icon={props.icon} size={"30px"}/>
<span>{props.text}</span>
<Icon icon={icon} size={"30px"}/>
<span>{text}</span>
</div>
);

IconWithText.propTypes = {
icon: PropTypes.any,
text: PropTypes.string,
};

export default IconWithText;
5 changes: 5 additions & 0 deletions src/components/Markdown/Markdown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import ReactMarkdown from 'react-markdown';
import PropTypes from 'prop-types';
import htmlParser from 'react-markdown/plugins/html-parser';

const parseHtml = htmlParser();
Expand All @@ -24,4 +25,8 @@ const Markdown = ({ src }) => (
/>
);

Markdown.propTypes = {
src: PropTypes.string,
};

export default Markdown;
12 changes: 11 additions & 1 deletion src/components/ResultCard/ResultCard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import Markdown from '../Markdown/Markdown';

import './ResultCard.css';
Expand All @@ -14,7 +15,12 @@ const ExamplesIfExists = ({ entry, examples }) => {
<Examples entry={ entry } examples={ examples } />
</ul>
);
}
};

ExamplesIfExists.propTypes = {
examples: PropTypes.array,
entry: PropTypes.string,
};

const ResultCard = ({ result }) => (
<div className={"result-card__container"}>
Expand All @@ -33,4 +39,8 @@ const ResultCard = ({ result }) => (
</div>
);

ResultCard.propTypes = {
result: PropTypes.object,
};

export default ResultCard;
12 changes: 9 additions & 3 deletions src/components/ResultsPage/ResultsPage.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React, {Component} from "react";
import "./ResultsPage.css"
import PropTypes from 'prop-types';
import Search from "../search/Search";
import { Link } from "react-router-dom";

import glossarioLogo from '../../../assets/images/glossario-logo.svg';

import acronyms from '../../lib/data';
import ResultCard from "../ResultCard/ResultCard";
import NotFound from "../404/NotFound";

import glossarioLogo from '../../../assets/images/glossario-logo.svg';
import "./ResultsPage.css"

const Results = ({ results }) => results.map(result => (
<ResultCard result={result} key={result.entry + result.meaning}/>
)
Expand Down Expand Up @@ -54,4 +55,9 @@ class ResultsPage extends Component {
}
}

ResultsPage.propTypes = {
match: PropTypes.object,
history: PropTypes.object,
};

export default ResultsPage;
22 changes: 16 additions & 6 deletions src/components/search/Search.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
import * as React from 'react';
import "./Search.css";
import { AutoComplete, Select } from 'antd';
import PropTypes from 'prop-types';
import Icon from "../Icon/Icon";
import "./Search.css";

const renderOption = (item) => (
<Select.Option key={item}>
{item}
</Select.Option>
);

const CustomSearchButton = (props) => (
<button className={"search__button-container pointer-hover lighter-hover"} onClick={props.handleClick}>
const CustomSearchButton = ({ handleClick }) => (
<button className={"search__button-container pointer-hover lighter-hover"} onClick={handleClick}>
<Icon className={"search__button"} icon={"search"} iconColor={"#FFFFFF"}/>
</button>
);

const Search = (props) => (
CustomSearchButton.propTypes = {
handleClick: PropTypes.func,
};

const Search = ({ items, handleSelect }) => (
<div className={"search"}>
<AutoComplete
dataSource={props.items.map(renderOption)}
dataSource={items.map(renderOption)}
optionLabelProp="meaning"
placeholder="Pesquise..."
onSelect={e => props.handleSelect(e)}
onSelect={e => handleSelect(e)}
filterOption={(inputValue, option) => option.props.children.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1}
/>
<CustomSearchButton/>
</div>
);

Search.propTypes = {
items: PropTypes.array,
handleSelect: PropTypes.func,
};

export default Search;
2 changes: 2 additions & 0 deletions src/scripts/orderData.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Script original em python por Júlio Barreto,
// traduzido para javascript por Paulo Leitão.

/* eslint no-console: 0 */

const fs = require('fs');

const dataFiles = ['cursos', 'disciplinas', 'girias', 'locais', 'outros'];
Expand Down
2 changes: 1 addition & 1 deletion webpack/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const webpack = require('webpack');
const webpack = require('webpack'); // eslint-disable-line no-unused-vars
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebPackPlugin = require("html-webpack-plugin");
Expand Down
2 changes: 1 addition & 1 deletion webpack/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const webpack = require('webpack');
const webpack = require('webpack'); // eslint-disable-line no-unused-vars
const merge = require('webpack-merge');
const path = require('path');
const common = require('./webpack.common');
Expand Down
2 changes: 1 addition & 1 deletion webpack/webpack.prod.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const webpack = require('webpack');
const webpack = require('webpack'); // eslint-disable-line no-unused-vars
const merge = require('webpack-merge');
const common = require('./webpack.common');

Expand Down