Skip to content

Commit

Permalink
Fixes #30840 - Add eslint spellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
ronlavi2412 authored and ezr-ondrej committed Oct 7, 2020
1 parent 121f1c3 commit 6540994
Show file tree
Hide file tree
Showing 16 changed files with 171 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ app/**
vendor/**
config/webpack.config.js
webpack/simple_named_modules.js
*.test.js
*.fixtures.js
*.stories.js
150 changes: 148 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,150 @@
{
"plugins": ["@theforeman/foreman"],
"extends": "plugin:@theforeman/foreman/core"
"plugins": ["@theforeman/foreman", "spellcheck"],
"extends": "plugin:@theforeman/foreman/core",
"rules": {
"spellcheck/spell-checker": [
"warn",
{
"comments": false,
"identifiers": false,
"strings": true,
"lang": "en_US",
"ignoreRequire": false,
"skipWords": [
"2xl",
"ampm",
"auditable",
"bool",
"bootable",
"btns",
"candlepin",
"centos",
"checkbox",
"clearbutton",
"clearfix",
"consts",
"csrf",
"csv",
"datastore",
"datastores",
"datepicker",
"datetime",
"datetimepicker",
"debian",
"decrement", // should be removed once https://github.com/aotaduy/eslint-plugin-spellcheck/issues/67 is resolved.
"devs",
"donut",
"dow",
"dropdown",
"dropdowns",
"ec2",
"erb",
"fieldset",
"fnc",
"formatter",
"fqdn",
"func",
"gettext",
"glyphicon",
"gridster",
"href",
"internets",
"ip6",
"javascript",
"javascripts",
"jed",
"katello",
"keybind",
"keypress",
"klasses",
"lang",
"ldap",
"loc",
"locs",
"lsi",
"menuitem",
"monokai",
"mousedown",
"mouseup",
"msg",
"nailgun",
"nat",
"navitem",
"netgroups",
"networksurl",
"nfs",
"nonpersistent",
"noopener",
"noreferrer",
"num",
"operatingsystem",
"orderable",
"orgs",
"ownfield",
"paravirtual",
"patternfly",
"pficon",
"poolsurl",
"pqr",
"ptable",
"puppetclass",
"puppetclasses",
"qcow2",
"rbt",
"readonly",
"redhat",
"redux",
"refetches",
"rendering",
"rhel",
"sbs",
"scrollable",
"scsi",
"securityfailure",
"sizex",
"sizey",
"storages",
"stringified",
"subcomponent",
"subcomponents",
"subnet",
"subnets",
"substate",
"svg",
"testoption",
"testoption",
"textarea",
"textfield",
"tfm",
"timepicker",
"timerdelay",
"timeseries",
"tlv",
"tooltip",
"turbolinks",
"twipsy",
"txt",
"typeahead",
"ubuntu",
"uncheck",
"unencrypted",
"unmount",
"unordered",
"unprocessable",
"unselect",
"unstyled",
"vms",
"vmware",
"vnc",
"webpack",
"wss",
"xml",
"xpi",
"xyz",
"yaml"
],
"minLength": 3
}
]
}
}
2 changes: 2 additions & 0 deletions .github/workflows/js_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
run: npm install
- name: Run linter
run: npm run lint
- name: Run Spellcheck (only warnings)
run: npm run lint:spelling
- name: Run tests
run: npm run test
- name: Publish Coveralls (node v14)
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"private": true,
"scripts": {
"lint": "tfm-lint",
"lint:spelling": "eslint ./webpack",
"foreman-js:link": "./script/npm_link_foreman_js.sh",
"postlint": "./script/npm_lint_plugins.js",
"test": "tfm-test",
Expand All @@ -21,6 +22,7 @@
},
"dependencies": {
"@theforeman/vendor": "^4.14.0",
"eslint-plugin-spellcheck": "0.0.17",
"intl": "~1.2.5",
"jed": "^1.1.1",
"react-intl": "^2.8.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const AuditCard = ({ hostName }) => {
</Accordion>
<Button
component="a"
href={foremanUrl(`/audits?seach=host+%3D+${hostName}`)}
href={foremanUrl(`/audits?search=host+%3D+${hostName}`)}
target="_blank"
variant="link"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`HostDetails - ParametersCard should render HostDetails ParametersCard 1
isHoverable={true}
>
<CardBody>
Paramterers
Parameters
</CardBody>
<Accordion
asDefinitionList={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ParametersCard = ({ paramters }) => {
};
return (
<Card isHoverable>
<CardBody>{__('Paramterers')}</CardBody>
<CardBody>{__('Parameters')}</CardBody>
<Accordion asDefinitionList>
{!paramters.length && (
<div style={{ marginLeft: '20px' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exports[`HostDetails - Interfaces should render UserProfile 1`] = `
</DataListItemRow>
</DataListItem>
<DataListItem
aria-labelledby="architecutre"
aria-labelledby="architecture"
>
<DataListItemRow>
<DataListItemCells
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Properties = ({ hostData }) => (
/>
</DataListItemRow>
</DataListItem>
<DataListItem aria-labelledby="architecutre">
<DataListItem aria-labelledby="architecture">
<DataListItemRow>
<DataListItemCells
dataListCells={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ComponentWrapper = props => {
const { component, componentProps } = props.data;

if (component === 'ComponentWrapper') {
throw new Error('Cannot wrap componenet wrapper');
throw new Error('Cannot wrap component wrapper');
}

const registeredComponent = componentRegistry.getComponent(component);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const SubstringWrapper = ({ children, substring, Element }) => {

for (let i = 0; i < parts.length; i += 2) {
wrappedText[i] = (
<React.Fragment key={`${i}-fragement`}>
<React.Fragment key={`${i}-fragment`}>
{parts[i]}
{parts[i + 1] && <Element key={i}>{parts[i + 1]}</Element>}
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Select extends React.Component {
options,
disabled,
status = STATUS.RESOLVED,
errorMessage = __('An error occured.'),
errorMessage = __('An error occurred.'),
} = this.props;

let content;
Expand Down Expand Up @@ -127,7 +127,7 @@ Select.defaultProps = {
disabled: false,
options: {},
status: STATUS.RESOLVED,
errorMessage: __('An error occured.'),
errorMessage: __('An error occurred.'),
onChange: noop,
useSelect2: true,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`StorageContainer should render controller 1`] = `
allowClear={false}
className=""
disabled={false}
errorMessage="An error occured."
errorMessage="An error occurred."
label=""
name={null}
onChange={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const submitForm = ({

const errorToast = error =>
sprintf(
'Oh no! Something went wrong while submiting the form, the server returned the following error: %s',
'Oh no! Something went wrong while submitting the form, the server returned the following error: %s',
error
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ const ModelDeleteModal = props => {
enforceFocus
submitProps={{
url: `/api/v2/models/${id}`,
message: sprintf(__('Hardware Model %s was successfuly deleted'), name),
message: sprintf(
__('Hardware Model %s was successfully deleted'),
name
),
onSuccess: props.fetchAndPush,
submitBtnProps: {
bsStyle: 'danger',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`ModelDeleteModal should render a modal 1`] = `
id="modelDeleteModal"
submitProps={
Object {
"message": "Hardware Model %s was successfuly deleted",
"message": "Hardware Model %s was successfully deleted",
"onSuccess": [MockFunction],
"submitBtnProps": Object {
"bsStyle": "danger",
Expand Down

0 comments on commit 6540994

Please sign in to comment.