Skip to content
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

Update eslint and cover tests and scripts #6831

Merged
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 gui/.eslintignore

This file was deleted.

120 changes: 0 additions & 120 deletions gui/.eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions gui/.prettierignore

This file was deleted.

11 changes: 0 additions & 11 deletions gui/.prettierrc.yml

This file was deleted.

166 changes: 166 additions & 0 deletions gui/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
import eslint from '@eslint/js';
import prettier from 'eslint-plugin-prettier/recommended';
import react from 'eslint-plugin-react';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tseslint from 'typescript-eslint';

const namingConvention = [
{
selector: 'default',
format: ['camelCase'],
},
{
selector: 'variable',
modifiers: ['const'],
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
{
selector: 'variableLike',
format: ['camelCase'],
leadingUnderscore: 'allow',
},
{
selector: 'import',
format: ['camelCase', 'PascalCase', 'snake_case'],
},
{
selector: 'parameter',
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow',
},
{
selector: 'function',
format: ['camelCase', 'PascalCase'],
},
{
selector: 'memberLike',
format: ['camelCase'],
},
{
selector: 'typeProperty',
format: ['camelCase'],
filter: {
regex: '^(data-testid|aria-labelledby|aria-describedby)$',
match: false,
},
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: 'property',
format: null,
},
];

const memberOrdering = {
default: [
'public-field',
'protected-field',
'private-field',

'public-constructor',
'protected-constructor',
'private-constructor',

'public-method',
'protected-method',
'private-method',
],
};

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
react.configs.flat.recommended,
prettier,
{ ignores: ['build/*'] },
{
settings: {
react: {
createClass: 'createReactClass',
pragma: 'React',
version: 'detect',
},
},
},
{
files: ['**/*'],
ignores: ['src/renderer/**/*'],
languageOptions: {
globals: globals.node,
},
},
{
files: ['src/renderer/**/*'],
languageOptions: {
globals: globals.browser,
},
},
{
files: ['test/**/*'],
languageOptions: {
globals: globals.mocha,
},
},
{
files: ['src/**/*.{js,mjs,ts,tsx}'],
languageOptions: {
parserOptions: {
parser: '@typescript-eslint/parser',
project: './tsconfig.json',
ecmaVersion: '2018',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/no-floating-promises': 'error',
},
},
{
files: ['**/*.{js,mjs,ts,tsx}'],
plugins: {
'simple-import-sort': simpleImportSort,
},
rules: {
quotes: ['error', 'single', { avoidEscape: true }],
// 'prettier/prettier': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/member-ordering': ['error', memberOrdering],
'no-return-await': 'error',
'react/jsx-no-bind': 'error',
'@typescript-eslint/naming-convention': ['error', ...namingConvention],
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': false }],
'simple-import-sort/imports': 'error',

'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
},
},
{
files: ['test/**/*.spec.ts'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
},
},
{
files: ['tasks/*', 'scripts/*', 'gulpfile.js', 'init.js'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
);
Loading
Loading