Skip to content

Commit

Permalink
upgrade eslint config (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
ninedev-i authored Feb 4, 2025
1 parent 32992fb commit ea27459
Show file tree
Hide file tree
Showing 8 changed files with 3,217 additions and 1,286 deletions.
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"presets": [["@babel/preset-env", { "targets": "defaults" }], "@babel/preset-react"],
"presets": [
["@babel/preset-env", { "targets": "defaults" }],
["@babel/preset-react", { "runtime": "automatic" }]
],
"plugins": [
"@babel/plugin-transform-logical-assignment-operators",
"angularjs-annotate"
Expand Down
11 changes: 0 additions & 11 deletions .eslintignore

This file was deleted.

14 changes: 0 additions & 14 deletions .eslintrc

This file was deleted.

11 changes: 0 additions & 11 deletions .prettierignore

This file was deleted.

6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wb-mqtt-homeui (2.108.0) stable; urgency=medium

* Upgrade eslint configuration

-- Victor Vedenin <[email protected]> Fri, 31 Jan 2025 15:52:20 +0300

wb-mqtt-homeui (2.107.7) stable; urgency=medium

* Remove debian/wb-mqtt-homeui.dirs, no functional changes
Expand Down
116 changes: 116 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import js from '@eslint/js';
import stylisticPlugin from '@stylistic/eslint-plugin';
import importPlugin from 'eslint-plugin-import';
import reactPlugin from 'eslint-plugin-react';
import globals from 'globals';

export default [
{
files: [
'**/*.js',
'**/*.mjs',
'**/*.jsx',
],
ignores: [
'.git/**',
'dist/**',
'test/**',
'node_modules/**',
'webpack.config.js',

// legacy code
'app/3rdparty/**',
'app/lib/**',
'app/scripts/**',
'!app/scripts/react-directives/**',
],
rules: {
...js.configs.recommended.rules,
eqeqeq: 2,
strict: [2, 'never'],
'no-var': 1,
'no-empty': 0,
'no-param-reassign': 2,
'no-restricted-globals': 0,
'no-unused-vars': [2, { args: 'after-used', caughtErrors: 'none', argsIgnorePattern: '^_' }],
'no-return-assign': 0,
'no-console': 0,
'no-underscore-dangle': 0,
'no-restricted-imports': [2, { paths: [{ name: 'react', importNames: ['default'] }] }],
'stylistic/semi': 1,
'stylistic/indent': [1, 2],
'stylistic/quotes': [1, 'single'],
'stylistic/quote-props': [1, 'as-needed'],
'stylistic/no-extra-semi': 1,
'stylistic/linebreak-style': 0,
'stylistic/eol-last': 1,
'stylistic/keyword-spacing': 1,
'stylistic/brace-style': 1,
'stylistic/arrow-parens': 1,
'stylistic/space-infix-ops': 1,
'stylistic/space-unary-ops': 1,
'stylistic/spaced-comment': 1,
'stylistic/space-in-parens': 1,
'stylistic/object-curly-spacing': [1, 'always' ],
'stylistic/no-multi-spaces': 1,
'stylistic/switch-colon-spacing': 1,
'stylistic/no-trailing-spaces': 1,
'stylistic/no-multiple-empty-lines': [2, { max: 1, maxBOF: 0, maxEOF: 0 }],
'stylistic/jsx-quotes': [1, 'prefer-double'],
'stylistic/jsx-closing-bracket-location': 1,
'stylistic/jsx-curly-spacing': [1, { when: 'never', children: true }],
'stylistic/jsx-self-closing-comp': [1, { component: true, html: false }],
'stylistic/jsx-sort-props': [1, { noSortAlphabetically: true, shorthandLast: true, callbacksLast: true }],
'stylistic/jsx-curly-brace-presence': [1, 'never'],
'stylistic/jsx-closing-tag-location': [1, 'tag-aligned'],
'stylistic/max-len': [1, { code: 120, comments: 160 }],
'stylistic/comma-spacing': 1,
'stylistic/comma-dangle': [1, { objects: 'always-multiline', imports: 'never', arrays: 'always-multiline' }],
'react/jsx-uses-vars': 2,
'react/react-in-jsx-scope': 0,
'react/jsx-uses-react': 0,
'import/no-cycle': 2,
'import/newline-after-import': 1,
'import/no-duplicates': 2,
'import/no-useless-path-segments': 1,
'import/no-dynamic-require': 1,
'import/order': [
1,
{
'newlines-between': 'never',
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
pathGroups: [
{ pattern: '@/**', group: 'internal', position: 'after' },
{ pattern: '~/**', group: 'internal', position: 'after' },
],
pathGroupsExcludedImportTypes: ['internal', 'external', 'builtins'],
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
},
settings: {
react: {
version: 'detect',
},
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.jest,
...globals.node,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
stylistic: stylisticPlugin,
import: importPlugin,
react: reactPlugin,
},
},
];
Loading

0 comments on commit ea27459

Please sign in to comment.