Skip to content

Commit

Permalink
upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
night committed Dec 23, 2024
1 parent b5bf7c8 commit 0f11def
Show file tree
Hide file tree
Showing 26 changed files with 178 additions and 96 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

53 changes: 0 additions & 53 deletions .eslintrc

This file was deleted.

3 changes: 1 addition & 2 deletions dev/post-install.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {statSync, writeFileSync, readFileSync, lstatSync} from 'fs';
// eslint-disable-next-line import/no-unresolved

import {globSync} from 'glob';
import {escapeRegExp} from '../src/utils/regex.js';

Expand All @@ -16,7 +16,6 @@ const files = globSync('node_modules/*rsuite*/**/*.+(js|ts|tsx|less|css)', {}).f
);
for (const pathname of files) {
if (lstatSync(pathname).isDirectory()) {
// eslint-disable-next-line no-console
console.warn(`[POST INSTALL] Processing file ${pathname}, but it is a directory. skipping...`);
continue;
}
Expand Down
85 changes: 85 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import babelParser from '@babel/eslint-parser';
import {fixupConfigRules} from '@eslint/compat';
import {FlatCompat} from '@eslint/eslintrc';
import js from '@eslint/js';
import globals from 'globals';

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: ['**/build', '**/node_modules'],
},
...fixupConfigRules(
compat.extends(
'plugin:import/recommended',
'plugin:react/recommended',
'plugin:eslint-plugin/recommended',
'plugin:prettier/recommended'
)
),
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},

parser: babelParser,
ecmaVersion: 6,
sourceType: 'module',

parserOptions: {
requireConfigFile: false,
allowImportExportEverywhere: true,

babelOptions: {
presets: ['@babel/preset-react'],
},
},
},

settings: {
react: {
version: 'detect',
},
},

rules: {
'prettier/prettier': ['error'],
'import/extensions': ['error', 'ignorePackages'],
'react/prop-types': 'off',
'react/jsx-props-no-spreading': 'off',
'no-param-reassign': 'off',
'no-underscore-dangle': 'off',
'no-continue': 'off',
'no-restricted-syntax': 'off',
'class-methods-use-this': 'off',
'no-plusplus': 'off',
'no-empty': 'off',
'max-classes-per-file': 'off',
'no-bitwise': 'off',
'import/no-named-as-default': 'off',

'import/order': [
'error',
{
groups: ['builtin', 'external', 'parent', 'sibling', 'index'],

alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
},
];
83 changes: 78 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,11 @@
"browserslist": [
"last 1 version",
"> 0.25%, not dead"
]
],
"devDependencies": {
"@eslint/compat": "^1.2.4",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.17.0",
"globals": "^15.14.0"
}
}
2 changes: 0 additions & 2 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable prefer-destructuring */

export const NODE_ENV = process.env.NODE_ENV;
export const EXT_VER = process.env.EXT_VER;
export const GIT_REV = process.env.GIT_REV;
Expand Down
3 changes: 0 additions & 3 deletions src/i18n/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ let browserLocale = Array.isArray(navigator.languages) ? navigator.languages[0]
browserLocale = browserLocale || navigator.language || navigator.browserLanguage || navigator.userLanguage;
browserLocale = browserLocale.replace('_', '-');
if (!SUPPORTED_LOCALES.includes(browserLocale)) {
// eslint-disable-next-line prefer-destructuring
browserLocale = browserLocale.split('-')[0];
}
if (!SUPPORTED_LOCALES.includes(browserLocale)) {
Expand All @@ -46,7 +45,6 @@ function getSiteLocale() {
}
locale = locale.replace('_', '-');
if (!SUPPORTED_LOCALES.includes(locale)) {
// eslint-disable-next-line prefer-destructuring
locale = locale.split('-')[0];
}
if (!SUPPORTED_LOCALES.includes(locale)) {
Expand All @@ -71,7 +69,6 @@ export async function load() {
Settings.defaultLocale = locale;
}

// eslint-disable-next-line import/prefer-default-export
export default function formatMessage(descriptor, values = undefined) {
if (intl == null) {
throw new Error('i18n not yet loaded');
Expand Down
1 change: 0 additions & 1 deletion src/modules/chat_custom_timeouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ function createCustomTimeout() {
}

function setReason(type) {
/* eslint-disable-next-line no-alert */
const reason = prompt(formatMessage({defaultMessage: 'Enter {type} reason: (leave blank for none)'}, {type}));
return reason || '';
}
Expand Down
3 changes: 1 addition & 2 deletions src/modules/chat_deleted_messages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class ChatDeletedMessagesModule {
}
const messages = findAllUserMessages(name, targetMessageId);
messages.forEach((message) => {
// eslint-disable-next-line default-case
switch (deletedMessages) {
case DeletedMessageTypes.HIDE:
message.style.display = 'none';
Expand All @@ -109,7 +108,7 @@ class ChatDeletedMessagesModule {
ChatHighlightBlacklistKeywords.markHighlighted(message);
}
message.classList.toggle(CHAT_LINE_DELETED_CLASS, true);
/* eslint-disable-next-line func-names */

message.querySelectorAll(CHAT_LINE_LINK_SELECTOR).forEach((node) => {
node.removeAttribute('href');
});
Expand Down
1 change: 0 additions & 1 deletion src/modules/chat_font_settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function updateFontSettings() {
}

function changeFontSetting(promptBody, storageID) {
/* eslint-disable-next-line no-alert */
let keywords = prompt(promptBody, storage.get(storageID) || '');
if (keywords !== null) {
keywords = keywords.trim();
Expand Down
Loading

0 comments on commit 0f11def

Please sign in to comment.