Skip to content

Commit

Permalink
Update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
bijij committed Jun 25, 2024
1 parent 87629d8 commit 61ff5c1
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 50 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

39 changes: 0 additions & 39 deletions .eslintrc.json

This file was deleted.

5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: CI

on: [push, pull_request]

env:
ESLINT_USE_FLAT_CONFIG: false

jobs:
build:

Expand All @@ -16,7 +13,7 @@ jobs:

- name: Install Deps
run: |
npm install eslint
npm install globals @eslint/js @eslint/eslintrc
npm install eslint-plugin-json
- name: Lint with ESLint
run: |
Expand Down
46 changes: 46 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import json from "eslint-plugin-json";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: ["node_modules/*", "**/eslint.config.mjs"],
}, ...compat.extends("eslint:recommended"), {
plugins: {
json,
},

languageOptions: {
globals: {
...globals.browser,
chrome: false,
browser: false,
},

ecmaVersion: 2020,
sourceType: "module",
},

rules: {
"no-global-assign": ["error"],

indent: ["error", 4, {
SwitchCase: 1,
}],

"linebreak-style": "off",
quotes: ["error", "single"],
semi: ["error", "always"],
"eol-last": "error",
},
}];
10 changes: 5 additions & 5 deletions js/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function getContainer(node) {
[
['.irc_c[style*="visibility: visible;"][style*="transform: translate3d(0px, 0px, 0px);"]', VERSIONS.FEB18],
['.irc_c[data-ved]', VERSIONS.JUL19],
['.tvh9oe[style*="display: block;"]', VERSIONS.OCT19]
['.EIehLd[style*="display: block;"]', VERSIONS.OCT19]
['.tvh9oe[style*="display: block;"]', VERSIONS.OCT19],
['.EIehLd[style*="display: block;"]', VERSIONS.OCT19],
['.fHE6De[style*="display: block;"]', VERSIONS.OCT19]
].forEach(element => {
var child = node.querySelector(element[0]);
Expand Down Expand Up @@ -202,7 +202,7 @@ function addViewImageButton(container, node, imageURL, version) {
console.log('ViewImage: Adding Disabled View-Image button with no URL');

viewImageLink.style = 'pointer-events: none;';
viewImageLink.title = "No full-sized image was found."
viewImageLink.title = 'No full-sized image was found.';

var viewImageDiv = viewImageLink.querySelector('div');
if (viewImageDiv) {
Expand Down Expand Up @@ -384,7 +384,7 @@ function parseDataSource(array) {
for (var i = 0; i < meta.length; i++) {
try {
images[meta[i][1][2][0]] = meta[i][1][3][0];
} catch (error) {
} catch {
if (DEBUG)
console.log('ViewImage: Skipping image');
}
Expand All @@ -399,7 +399,7 @@ function parseDataSource(array) {
try {
var data = Object.values(meta[i][0][0])[0];
images[data[1][2][0]] = data[1][3][0];
} catch (error) {
} catch {
if (DEBUG)
console.log('ViewImage: Skipping image');
}
Expand Down

0 comments on commit 61ff5c1

Please sign in to comment.