Skip to content

Commit

Permalink
chore: migrate to eslint 9
Browse files Browse the repository at this point in the history
  • Loading branch information
clemstoquart committed Jun 3, 2024
1 parent 899d9a2 commit e9c2cf0
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 238 deletions.
10 changes: 0 additions & 10 deletions .eslintignore

This file was deleted.

38 changes: 0 additions & 38 deletions .eslintrc.js

This file was deleted.

45 changes: 45 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import eslint from '@eslint/js';
import globals from 'globals';

export default [
eslint.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.webextensions,
...globals.jest,
...globals.node,
}
}
},
{
files: ['**/*.js'],
rules: {
indent: [
'error',
4
],
'linebreak-style': [
'error',
'unix'
],
quotes: [
'error',
'single'
],
semi: [
'error',
'always'
],
'no-console': 0,
'curly': 'error',
'eqeqeq': 'error',
}
},
{
ignores: ['package-lock.json', '.idea/*', 'web-ext-artifacts/*']
}
];
7 changes: 2 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict';

const findJsonMimeType = function (header) {
export const findJsonMimeType = function (header) {
if (header.name === undefined) {
return false;
}
return header.name.toLowerCase() === 'content-type' && header.value.includes('json');
};

const overrideJsonHeader = function (request) {
export const overrideJsonHeader = function (request) {
return new Promise((resolve) => {
if (request.responseHeaders.find(findJsonMimeType)) {
const jsonHeader = {
Expand All @@ -31,6 +31,3 @@ browser.webRequest.onHeadersReceived.addListener(
'responseHeaders'
]
);

exports.findJsonMimeType = findJsonMimeType;
exports.overrideJsonHeader = overrideJsonHeader;
Loading

0 comments on commit e9c2cf0

Please sign in to comment.