Skip to content
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
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ updates:
- "vue-eslint-parser"
- "neostandard"
- "@intlify/eslint-plugin-vue-i18n"
- "@stylistic/eslint-plugin"
stylelint:
patterns:
- "stylelint"
Expand Down
218 changes: 210 additions & 8 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import js from '@eslint/js'
import jsoncEslintParser from 'jsonc-eslint-parser'
import eslintPluginJsonc from 'eslint-plugin-jsonc'
import eslintPluginYml from 'eslint-plugin-yml'
// Faster than importing the default import,
// because the default import imports a lot of other dependencies
// for the `resolveIgnoresFromGitignore` function that we don't use
import { neostandard } from 'neostandard/lib/main.js'
import jsdoc from 'eslint-plugin-jsdoc'

import stylistic from '@stylistic/eslint-plugin'
import eslintPluginImportX from 'eslint-plugin-import-x'
import eslintPluginN from 'eslint-plugin-n'
import eslintPluginPromise from 'eslint-plugin-promise'

import freetube from './_scripts/eslint-rules/plugin.mjs'

import activeLocales from './static/locales/activeLocales.json' with { type: 'json' }
Expand All @@ -27,10 +29,210 @@ export default [
'static/geolocations/'
]
},
...neostandard({
noJsx: true,
ts: false,
}),
{
name: 'base',

languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.es2022,
...globals.node,
document: 'readonly',
navigator: 'readonly',
window: 'readonly',
},
},

plugins: {
'import-x': eslintPluginImportX,
n: eslintPluginN,
promise: eslintPluginPromise,
},

rules: {
'no-var': 'warn',
'object-shorthand': ['warn', 'properties'],

'accessor-pairs': ['error', { setWithoutGet: true, enforceForClassMembers: true }],
'array-callback-return': ['error', {
allowImplicit: false,
checkForEach: false,
}],
camelcase: ['error', {
allow: ['^UNSAFE_'],
properties: 'never',
ignoreGlobals: true,
}],
curly: ['error', 'multi-line'],
'default-case-last': 'error',
eqeqeq: ['error', 'always', { null: 'ignore' }],
'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
'no-array-constructor': 'error',
'no-caller': 'error',
'no-constant-condition': ['error', { checkLoops: false }],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-implied-eval': 'error',
'no-iterator': 'error',
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
'no-lone-blocks': 'error',
'no-multi-str': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-object-constructor': 'error',
'no-new-wrappers': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-redeclare': ['error', { builtinGlobals: false }],
'no-return-assign': ['error', 'except-parens'],
'no-self-compare': 'error',
'no-sequences': 'error',
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-undef-init': 'error',
'no-unmodified-loop-condition': 'error',
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
'no-unreachable-loop': 'error',
'no-unused-expressions': ['error', {
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
}],
'no-unused-vars': ['error', {
args: 'none',
caughtErrors: 'none',
ignoreRestSiblings: true,
vars: 'all',
}],
'no-use-before-define': ['error', { functions: false, classes: false, variables: false }],
'no-useless-call': 'error',
'no-useless-computed-key': 'error',
'no-useless-constructor': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-void': 'error',
'one-var': ['error', { initialized: 'never' }],
'prefer-const': ['error', { destructuring: 'all' }],
'prefer-promise-reject-errors': 'error',
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
'symbol-description': 'error',
'unicode-bom': ['error', 'never'],
'use-isnan': ['error', {
enforceForSwitchCase: true,
enforceForIndexOf: true,
}],
'valid-typeof': ['error', { requireStringLiterals: true }],
yoda: ['error', 'never'],

'import-x/export': 'error',
'import-x/first': 'error',
'import-x/no-absolute-path': ['error', { esmodule: true, commonjs: true, amd: false }],
'import-x/no-duplicates': 'error',
'import-x/no-named-default': 'error',
'import-x/no-webpack-loader-syntax': 'error',

'n/handle-callback-err': ['error', '^(err|error)$'],
'n/no-callback-literal': 'error',
'n/no-deprecated-api': 'warn',
'n/no-exports-assign': 'error',
'n/no-new-require': 'error',
'n/no-path-concat': 'error',
'n/process-exit-as-throw': 'error',

'promise/param-names': 'error',
},
},
{
name: 'style',

plugins: {
'@stylistic': stylistic,
},
rules: {
'@stylistic/array-bracket-spacing': ['error', 'never'],
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
'@stylistic/block-spacing': ['error', 'always'],
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'@stylistic/comma-dangle': ['warn', {
arrays: 'ignore',
enums: 'ignore',
exports: 'ignore',
imports: 'ignore',
objects: 'ignore',
}],
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
'@stylistic/comma-style': ['error', 'last'],
'@stylistic/computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
'@stylistic/dot-location': ['error', 'property'],
'@stylistic/eol-last': 'error',
'@stylistic/function-call-spacing': ['error', 'never'],
'@stylistic/generator-star-spacing': ['error', { before: true, after: true }],
'@stylistic/indent': ['error', 2, {
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
MemberExpression: 1,
FunctionDeclaration: { parameters: 1, body: 1 },
FunctionExpression: { parameters: 1, body: 1 },
CallExpression: { arguments: 1 },
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
flatTernaryExpressions: false,
ignoreComments: false,
ignoredNodes: ['TemplateLiteral *'],
offsetTernaryExpressions: true,
}],
'@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
'@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'@stylistic/multiline-ternary': ['error', 'always-multiline'],
'@stylistic/new-parens': 'error',
'@stylistic/no-extra-parens': ['error', 'functions'],
'@stylistic/no-floating-decimal': 'error',
'@stylistic/no-mixed-operators': ['error', {
groups: [
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
allowSamePrecedence: true,
}],
'@stylistic/no-mixed-spaces-and-tabs': 'error',
'@stylistic/no-multi-spaces': ['error', { ignoreEOLComments: true }],
'@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'@stylistic/no-tabs': 'error',
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/no-whitespace-before-property': 'error',
'@stylistic/object-curly-newline': ['error', { multiline: true, consistent: true }],
'@stylistic/object-curly-spacing': ['error', 'always'],
'@stylistic/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before', '|>': 'before' } }],
'@stylistic/padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
'@stylistic/quote-props': ['error', 'as-needed'],
'@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: 'never' }],
'@stylistic/rest-spread-spacing': ['error', 'never'],
'@stylistic/semi': ['error', 'never'],
'@stylistic/semi-spacing': ['error', { before: false, after: true }],
'@stylistic/space-before-blocks': ['error', 'always'],
'@stylistic/space-before-function-paren': ['error', 'always'],
'@stylistic/space-in-parens': ['error', 'never'],
'@stylistic/space-infix-ops': 'error',
'@stylistic/space-unary-ops': ['error', { words: true, nonwords: false }],
'@stylistic/spaced-comment': ['error', 'always', {
line: { markers: ['*package', '!', '/', ',', '='] },
block: { balanced: true, markers: ['*package', '!', ',', ':', '::', 'flow-include'], exceptions: ['*'] },
}],
'@stylistic/template-curly-spacing': ['error', 'never'],
'@stylistic/template-tag-spacing': ['error', 'never'],
'@stylistic/wrap-iife': ['error', 'any', { functionPrototypeMethods: true }],
'@stylistic/yield-star-spacing': ['error', 'both'],
},
},

js.configs.recommended,
...eslintPluginVue.configs['flat/recommended'],
...vuejsAccessibility.configs["flat/recommended"],
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,19 @@
"@double-great/stylelint-a11y": "^3.4.3",
"@eslint/js": "^9.39.2",
"@intlify/eslint-plugin-vue-i18n": "^4.1.1",
"@stylistic/eslint-plugin": "^5.9.0",
"babel-loader": "^10.0.0",
"copy-webpack-plugin": "^13.0.1",
"css-loader": "^7.1.4",
"css-minimizer-webpack-plugin": "^7.0.4",
"electron": "^40.6.1",
"electron-builder": "^26.8.1",
"eslint": "^9.39.2",
"eslint-plugin-import-x": "^4.16.1",
"eslint-plugin-jsdoc": "^62.5.2",
"eslint-plugin-jsonc": "^2.21.0",
"eslint-plugin-n": "^17.24.0",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-unicorn": "^62.0.0",
"eslint-plugin-vue": "^10.7.0",
"eslint-plugin-vuejs-accessibility": "^2.4.1",
Expand All @@ -96,7 +100,6 @@
"json-minimizer-webpack-plugin": "^5.0.1",
"lefthook": "^2.1.1",
"mini-css-extract-plugin": "^2.10.0",
"neostandard": "^0.12.2",
"npm-run-all2": "^8.0.4",
"postcss": "^8.5.6",
"postcss-scss": "^4.0.9",
Expand Down
2 changes: 1 addition & 1 deletion static/locales/ar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1090,5 +1090,5 @@ Description:
Expand Description: '...المزيد'
Autoplay Interruption Timer: تم إلغاء التشغيل التلقائي بسبب {autoplayInterruptionIntervalHours} ساعات من عدم النشاط
shortcutJoinOperator: +
shortcutLabelSeparator: '|'
shortcutLabelSeparator: '{''|''}'
KeyboardShortcutTemplate: '{label} ({shortcut})'
2 changes: 1 addition & 1 deletion static/locales/bg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,6 @@ KeyboardShortcutPrompt:
End: Преминаване към края на видеото
Skip to Next Video: Преминаване към следващото видео в плейлиста или към следващото препоръчано
Skip to Previous Video: Преминаване към предходното видео в плейлиста
shortcutLabelSeparator: '|'
shortcutLabelSeparator: '{''|''}'
Compact side navigation: Компактна странична навигация
Expand side navigation: Разширена странична навигация
2 changes: 1 addition & 1 deletion static/locales/eu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ User Playlists:
This playlist currently has no videos.: Erreprodukzio-zerrenda honek ez du bideorik.
Create New Playlist: Sortu erreprodukzio-zerrenda berria
Add to Playlist: Gehitu erreprodukzio-zerrendara
Add to Favorites: Gehitu {playlistName zerrendara
Add to Favorites: Gehitu {playlistName} zerrendara
Remove from Favorites: Kendu {playlistName} zerrendatik
Move Video Up: Mugitu bideoa gora
Move Video Down: Mugitu bideoa behera
Expand Down
Loading