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

Part of #1117: Move more dependencies to latest or closer #1118

Merged
merged 9 commits into from
Jan 9, 2025
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

65 changes: 0 additions & 65 deletions .eslintrc.json

This file was deleted.

9 changes: 3 additions & 6 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "Running pre-commit hook with lint checks."

pids=""
Expand All @@ -18,19 +15,19 @@ get_changed_files()

readarray -t changed_css < <(get_changed_files 'css/*.css')
if [ ! -z "$changed_css" ]; then
npx stylelint -- "${changed_css[@]}" &
stylelint -- "${changed_css[@]}" &
pids="$pids $!"
fi

readarray -t changed_js < <(get_changed_files '*/*.cjs' '*/*.js' '*/*.mjs')
if [ ! -z "$changed_js" ]; then
npx eslint "${changed_js[@]}" &
eslint "${changed_js[@]}" &
pids="$pids $!"
fi

readarray -t changed_docs < <(get_changed_files 'locales/*/*.json' 'docs/*.md' '*.md')
if [ ! -z "$changed_docs" ]; then
npx prettier -c "${changed_docs[@]}" &
prettier -c "${changed_docs[@]}" &
pids="$pids $!"
fi

Expand Down
1 change: 0 additions & 1 deletion __tests__/__main__/date-aux.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__main__/import-export.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__main__/main-window.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__main__/notification.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__main__/time-balance.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__main__/time-math.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__main__/user-preferences.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__main__/validate-json.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__main__/windows.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__renderer__/classes/CalendarFactory.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import '../../../__mocks__/jquery.mjs';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__renderer__/classes/DayCalendar.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import '../../../__mocks__/jquery.mjs';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__renderer__/classes/MonthCalendar.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import '../../../__mocks__/jquery.mjs';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__renderer__/preferences.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import '../../__mocks__/jquery.mjs';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__renderer__/themes.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import '../../__mocks__/jquery.mjs';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__renderer__/user-preferences.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__renderer__/window-aux.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion __tests__/__renderer__/workday-waiver-aux.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
'use strict';

import '../../__mocks__/jquery.mjs';
Expand Down
83 changes: 83 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

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 [{
files: [
'**/*.cjs', '**/*.js', '**/*.mjs'
],

ignores: [
'**/assets/',
'**/coverage/',
'**/node_modules/',
'**/*.svg',
'**/*.html',
'**/*.css',
'**/release-builds',
],
}, ...compat.extends('eslint:recommended'), {
languageOptions: {
globals: {
...globals.browser,
...globals.commonjs,
...globals.node,
...globals.mocha,
...globals.jquery,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},

ecmaVersion: 2020,
sourceType: 'module',

parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},

rules: {
'block-spacing': 'error',
'eqeqeq': ['error', 'always'],

'brace-style': ['error', 'allman', {
'allowSingleLine': true,
}],

'func-call-spacing': ['error', 'never'],
'indent': 'error',
'keyword-spacing': 'error',
'linebreak-style': ['error', 'unix'],
'no-extra-semi': 'error',
'no-lonely-if': 'error',
'no-var': 'error',

'prefer-const': ['error', {
'destructuring': 'all',
}],

'quotes': ['error', 'single'],
'semi': 'error',
'no-trailing-spaces': 'error',

'semi-spacing': ['error', {
'before': false,
'after': true,
}],

'space-before-blocks': 'error',
'space-before-function-paren': ['error', 'never'],
},
}];
4 changes: 2 additions & 2 deletions js/import-export.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function _exportDatabaseToFile(filename)
{
fs.writeFileSync(filename, JSON.stringify(information, null,'\t'), 'utf-8');
}
catch (err)
catch
{
return false;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ function _importDatabaseFromFile(filename)
return {'result': false, 'total': information.length, 'failed': failedEntries};
}
}
catch (err)
catch
{
return {'result': false, 'total': 0, 'failed': 0};
}
Expand Down
3 changes: 1 addition & 2 deletions js/squirrel.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ function handleSquirrelEvent(application)
detached: true
});
}
catch (error)
catch
{
// eslint-disable-next-line no-empty
// We don't need to do anything in this block.
}

Expand Down
2 changes: 1 addition & 1 deletion js/user-preferences.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function readPreferences(filePath = getPreferencesFilePath())
{
preferences = JSON.parse(getFs().readFileSync(filePath));
}
catch (err)
catch
{
preferences = {};
}
Expand Down
2 changes: 1 addition & 1 deletion js/validate-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function isValidDate(year, month, day)
*/
Validator.prototype.customFormats.dateFormat = function(dateStr)
{
if (!typeof(dateStr) === 'String' || !dateStr.includes('-'))
if (!(typeof(dateStr) === 'string') || !dateStr.includes('-'))
{
return false;
}
Expand Down
5 changes: 1 addition & 4 deletions main.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/*eslint-disable no-useless-escape*/
/*eslint-disable no-global-assign*/
'use strict';

import { app, ipcMain } from 'electron';
Expand Down Expand Up @@ -191,9 +189,8 @@ if (env === 'development')
{
require('electron-reloader')(module);
}
catch (_)
catch
{
// eslint-disable-next-line no-empty
// We don't need to do anything in this block.
}
}
Loading