Skip to content

fix: Replace unmaintained useragent with ua-parser-js #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

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

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/audit-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "22.x"

- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "22.x"

- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "22.x"

- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
Expand Down
4 changes: 2 additions & 2 deletions client/ExtensionCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { log } from 'util';
import * as webpack from 'webpack';
import ExtensionReloaderImpl from '../src/ExtensionReloader';
import { info } from '../src/utils/logger';
import { IPluginOptions } from '../typings/webpack-ext-reloader';
import { IPluginOptions } from '../typings/webpack-ext-reloader-internal';

export default class ExtensionCompiler {
private static treatErrors(err) {
Expand All @@ -20,7 +20,7 @@ export default class ExtensionCompiler {
}

public watch() {
// eslint-disable-next-line consistent-return
this.compiler.watch({}, (err, stats) => {
if (err) {
return ExtensionCompiler.treatErrors(err);
Expand Down
6 changes: 3 additions & 3 deletions client/args-parser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable no-throw-literal */
import { resolve } from 'path';
import { cwd } from 'process';
import { log } from 'util';
import { DEFAULT_CONFIG, DEFAULT_PORT } from '../src/constants/options.constants';
import { IPluginOptions } from '../typings/webpack-ext-reloader';
import { IPluginOptions } from '../typings/webpack-ext-reloader-internal';
import { CONFIG, HELP, MANIFEST, NO_PAGE_RELOAD, PORT } from './args.constant';
import { SIG_EXIT } from './events.constants';
import manual from './manual';
Expand All @@ -27,7 +27,7 @@ export default (args: object) => {
const optPath = resolve(cwd(), config);

try {
// eslint-disable-next-line no-eval
const webpackConfig = eval('require')(optPath);
return { webpackConfig, pluginOptions };
} catch (err) {
Expand Down
89 changes: 89 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
import importPlugin from 'eslint-plugin-import';
import prettierPlugin from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';

export default tseslint.config(
{
ignores: ['node_modules/', 'dist/', 'sample/', '.github/'],
},

js.configs.recommended,
...tseslint.configs.recommended,

reactPlugin.configs.flat.recommended,
jsxA11yPlugin.flatConfigs.recommended,

{
plugins: { 'react-hooks': reactHooksPlugin },
rules: reactHooksPlugin.configs.recommended.rules,
},

{
plugins: { prettier: prettierPlugin },
rules: {
'prettier/prettier': 'off',
},
},

{
files: ['**/*.{js,ts,jsx,tsx}'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: { ...globals.browser, ...globals.es2021, window: 'readonly' },
},
plugins: {
import: importPlugin,
prettier: prettierPlugin,
'@typescript-eslint': tseslint.plugin,
},
settings: {
'import/resolver': {
node: {
paths: ['.', 'src'],
extensions: ['.js', '.ts', '.jsx', '.tsx'],
},
},
react: {
version: 'detect',
},
},
rules: {
'import/extensions': 'off',
'import/prefer-default-export': 'off',
'import/no-webpack-loader-syntax': 'off',
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': 'off',
'no-use-before-define': 'off',
'no-console': 'off',
'no-extend-native': 'off',
'no-param-reassign': 'off',
'class-methods-use-this': 'off',
'dot-notation': ['error', { allowKeywords: true }],
'func-names': 'off',
'no-underscore-dangle': 'off',
camelcase: 'warn',
'no-plusplus': 'off',
'no-nested-ternary': 'off',

'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-restricted-types': 'warn',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'no-unused-expressions': 'off',

'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',

'prettier/prettier': 'off',
},
},

prettierConfig,
);
Loading