Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Feature/eslint #897

Closed
wants to merge 4 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
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "react-app"
}
2 changes: 1 addition & 1 deletion auds.json

Large diffs are not rendered by default.

3,712 changes: 2,895 additions & 817 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
},
"devDependencies": {
"autoprefixer": "^9.4.10",
"babel-eslint": "^10.0.3",
"cfonts": "^2.4.2",
"chalk": "^2.4.2",
"eslint": "^6.8.0",
"eslint-config-react-app": "^5.1.0",
"eslint-plugin-flowtype": "^3.13.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^1.7.0",
"express": "^4.16.4",
"inquirer": "6.2.2",
"jest-cli": "^24.7.1",
Expand All @@ -30,7 +38,8 @@
"delete:node_modules": "lerna clean --yes && rimraf node_modules",
"delete:lib": "rimraf packages/*/lib",
"test:unit-test": "jest",
"test": "node scripts/helper.js test && node ./scripts/a11y.js"
"test": "node scripts/helper.js test && node ./scripts/a11y.js && npm run lint",
"lint": "lerna run lint"
},
"jest": {
"testRegex": "\\.spec.js$",
Expand Down
7 changes: 1 addition & 6 deletions packages/accordion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,16 @@
],
"scripts": {
"postinstall": "pancake",

"test:a11y": "node ../../scripts/a11y.js",
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js lib/js/react.js",
"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
"build:js": "npm run build:pre && node ../../scripts/helper.js compile",
"build:react": "cd tests/react/ && webpack",
"build": "npm run build:js && npm run build:react",

"serve": "browser-sync tests --files \"tests/**/*.html, tests/**/*.css, tests/**/*.js\"",

"watch:js": "onchange \"src/js/*.js\" -- npm run build:js",
"watch:jsx": "onchange \"src/js/react.js\" \"tests/react/index.js\" -- npm run build",
"watch:sass": "onchange \"src/sass/*.scss\" \"tests/site/test.scss\" -- npm run build",
Expand Down Expand Up @@ -63,7 +59,6 @@
"@gov.au/pancake-sass": "~2",
"@gov.au/pancake-react": "~1",
"@gov.au/pancake-json": "~1",

"@gov.au/animate": "^1.0.0",
"@gov.au/core": "^3.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/accordion/src/js/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class AUaccordion extends React.PureComponent {
// stop event propagation
try {
window.event.cancelBubble = true;
event.stopPropagation();
window.event.stopPropagation();
}
catch( error ) {}

Expand Down Expand Up @@ -250,7 +250,7 @@ class AUaccordion extends React.PureComponent {
// stop event propagation
try {
window.event.cancelBubble = true;
event.stopPropagation();
window.event.stopPropagation();
}
catch( error ) {}

Expand Down Expand Up @@ -312,7 +312,7 @@ class AUaccordion extends React.PureComponent {
// stop event propagation
try {
window.event.cancelBubble = true;
event.stopPropagation();
window.event.stopPropagation();
}
catch( error ) {}

Expand Down
2 changes: 2 additions & 0 deletions packages/breadcrumbs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/buttons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/callout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/card/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/control-input/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/cta-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/direction-links/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/footer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
1 change: 1 addition & 0 deletions packages/form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"test:a11y": "node ../../scripts/a11y.js",
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",
"lint": "node ../../scripts/eslint.js ./lib/js/react.js",
"prepublish": "npm run test:helper && npm run build:pre",
"build:pre": "node ../../scripts/helper.js precompile publish",
"build:js": "npm run build:pre && node ../../scripts/helper.js compile",
Expand Down
2 changes: 2 additions & 0 deletions packages/header/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/headings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/inpage-nav/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 1 addition & 1 deletion packages/inpage-nav/src/js/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
**************************************************************************************************************************************************************/

import React from 'react';
import React, {Fragment} from 'react';
import PropTypes from 'prop-types';


Expand Down
2 changes: 2 additions & 0 deletions packages/keyword-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/link-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/main-nav/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 1 addition & 1 deletion packages/main-nav/src/js/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class AUmainNavContent extends React.PureComponent {
// stop event propagation
try {
window.event.cancelBubble = true;
event.stopPropagation();
window.event.stopPropagation();
}
catch( error ) {}

Expand Down
2 changes: 2 additions & 0 deletions packages/page-alerts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/progress-indicator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/searchbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/side-nav/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/skip-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/text-inputs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"test:helper": "node ../../scripts/helper.js test",
"test": "npm-run-all --parallel test:*",

"lint": "node ../../scripts/eslint.js ./lib/js/react.js",

"prepublish": "npm run test:helper && npm run build:pre",

"build:pre": "node ../../scripts/helper.js precompile publish",
Expand Down
26 changes: 26 additions & 0 deletions scripts/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/***************************************************************************************************************************************************************
*
* ESLINT
*
**************************************************************************************************************************************************************/

"use strict";

const Helper = require("./helper.js");
const CLIEngine = require("eslint").CLIEngine;

const [_1, _2, ...files] = process.argv;

const cli = new CLIEngine();
const report = cli.executeOnFiles(files);
const formatter = cli.getFormatter();

// only get the error messages
const errorReport = CLIEngine.getErrorResults(report.results);

if (report.errorCount) {
Helper.log.error(formatter(errorReport));
process.exit(1);
} else {
Helper.log.success(`No linter errors`);
}