Skip to content

Commit

Permalink
No issue - added eslint and initial rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Manvel committed Dec 27, 2023
1 parent 7c6313e commit 23894ef
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
package-lock.json
dist
cba.zip
tests
jquery-1.7.2.min.js
22 changes: 22 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"env": {
"browser": true,
"node": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"global-require": "off",
"no-cond-assign": "off",
"no-empty": "off"
},
"globals": {
"cba": true,
"browser": true,
"chrome": true
}
}
5 changes: 4 additions & 1 deletion .github/workflows/running-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:

- name: Prepare dependencies
run: sudo apt-get install xvfb && npm install


- name: Run linters
run: npm run lint

- name: Run tests
run: xvfb-run npm test
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ be loaded in the chrome unless actual extension is reloaded in the
```bash
npm test # Run puppeteer test
npm run test:pages # Starts server with test page used by puppeteer
npm run lint # Run linter
```

## Publishing
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"test": "npm run build:webpack && (http-server tests/pages -s -p 3001 & mocha tests/mocha.js)",
"test:pages": "http-server tests/pages -s -p 3000",
"lint": "eslint .",
"posttest": "kill $(lsof -t -i:3001)",
"import:components": "cba-components --single-bundle --prod --output dist",
"build": "npm run clean && npm run build:webpack:prod && cd dist/;zip -r ../cba.zip .;cd ..",
Expand Down Expand Up @@ -33,6 +34,8 @@
"webpack": "^5.89.0"
},
"devDependencies": {
"eslint": "^8.56.0",
"eslint-plugin-jsdoc": "^46.9.1",
"http-server": "^14.1.1",
"mocha": "^10.2.0",
"webpack-cli": "^5.1.4"
Expand Down
3 changes: 3 additions & 0 deletions src/js/background/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ async function actionExecution(instruction)
break;
}
case "bg-inject": {
// eslint-disable-next-line no-unused-vars
let sendInstruction = () => "";
// eslint-disable-next-line no-unused-vars
const actionToPlay = (actionInd) => cba.instructArray = cba.defInstructArray.slice(actionInd);
let sendBgInstruction = true;
const clipboard = cba.clipboard;
Expand Down Expand Up @@ -125,6 +127,7 @@ async function bgFunctionParser(value) {
return false;

const functionName = method[1];
let attribute;
while (attribute = attributePattern.exec(value)) {
const clipboard = clipboardPattern.exec(attribute[1]);
if (clipboard)
Expand Down
2 changes: 1 addition & 1 deletion src/js/cs/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

let clipboard = {};

browser.runtime.onMessage.addListener((request, sender) => {
browser.runtime.onMessage.addListener((request) => {
if(request.action == "executeAction") {
clipboard = request.clipboard;
try {
Expand Down
2 changes: 1 addition & 1 deletion src/js/cs/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
require("./record");
require("./actions");

browser.runtime.onMessage.addListener((request, sender) => {
browser.runtime.onMessage.addListener((request) => {
if(request.action == "highlight") {
return setHighlight(request.selector);
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require("./ui/projects");

function trackButtonClick(e) {
_gaq.push(['_trackEvent', e.target.id, 'clicked']);
};
}

function analytAllButtons() {
var buttons = document.querySelectorAll('cba-button');
Expand Down
2 changes: 1 addition & 1 deletion src/js/ui/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ class Notification {
module.exports = {Notification, NO_PROJ_SELECTED, NO_PROJ_GROUP_SELECTED,
NO_ACTION_SELECTED, SELECT_PROJ_NOT_GROUP, CHANGES_SAVED,
NO_GROUP_ROOT_SELECTED, NO_IMPORT_DATA, NO_PROJ_GROUP_TYPE, PROJECT_IMPORTED,
NO_FUNCTION_NAME, NO_SELECTED_FUNCTION, CHANGES_SAVED, NAME_EXISTS_GROUP,
NO_FUNCTION_NAME, NO_SELECTED_FUNCTION, NAME_EXISTS_GROUP,
NAME_EXISTS_PROJECT, PROJECT_EDIT};

0 comments on commit 23894ef

Please sign in to comment.