mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
* lint: clean up unnecessary config and disables * fix: update package import path in browser preload script * lint: create custom ESLint rules for rules not in oxlint - Add object-shorthand-properties rule (replaces object-shorthand) - Add prefer-const rule (replaces prefer-const) - Add no-anchor-tag rule (replaces no-restricted-syntax for <a> tags) - Add no-react-default-import rule (replaces no-restricted-syntax for React.*) These custom rules are needed because oxlint doesn't support these rules yet. All rules are properly tested and integrated into the ESLint config. * refactor: enhance prefer-const rule to track variable reassignments by scope - Introduced a mapping of scopes to reassigned variable names, improving the accuracy of the prefer-const rule. - Added helper functions to determine variable scopes and reassignment status. - Updated logic to check variable reassignments during declaration analysis. - Adjusted test cases to reflect changes in variable handling.
97 lines
2.6 KiB
JavaScript
97 lines
2.6 KiB
JavaScript
import tsparser from '@typescript-eslint/parser';
|
|
import pluginPerfectionist from 'eslint-plugin-perfectionist';
|
|
import pluginTypescriptPaths from 'eslint-plugin-typescript-paths';
|
|
import { defineConfig } from 'eslint/config';
|
|
|
|
export default defineConfig(
|
|
{
|
|
ignores: [
|
|
'packages/api/app/bundle.api.js',
|
|
'packages/api/app/stats.json',
|
|
'packages/api/@types',
|
|
'packages/api/migrations',
|
|
'packages/crdt/src/proto/sync_pb.js',
|
|
'packages/component-library/src/icons/**/*',
|
|
'packages/desktop-client/bundle.browser.js',
|
|
'packages/desktop-client/dev-dist/',
|
|
'packages/desktop-client/service-worker/*',
|
|
'packages/desktop-client/build-electron/',
|
|
'packages/desktop-client/build-stats/',
|
|
'packages/desktop-client/public/kcab/',
|
|
'packages/desktop-client/public/data/',
|
|
'packages/desktop-client/test-results/',
|
|
'packages/desktop-client/playwright-report/',
|
|
'packages/desktop-electron/client-build/',
|
|
'packages/loot-core/**/lib-dist/*',
|
|
'packages/loot-core/**/proto/*',
|
|
'packages/sync-server/coverage/',
|
|
'packages/sync-server/user-files/',
|
|
'packages/sync-server/server-files/',
|
|
'.yarn/*',
|
|
'.github/*',
|
|
'**/build/',
|
|
'**/dist/',
|
|
'**/node_modules/',
|
|
],
|
|
},
|
|
{
|
|
linterOptions: {
|
|
reportUnusedDisableDirectives: true,
|
|
},
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
},
|
|
},
|
|
{
|
|
plugins: {
|
|
perfectionist: pluginPerfectionist,
|
|
},
|
|
rules: {
|
|
// TODO: https://github.com/oxc-project/oxc/issues/17076
|
|
'perfectionist/sort-imports': [
|
|
'warn',
|
|
{
|
|
groups: [
|
|
'react',
|
|
'builtin',
|
|
'external',
|
|
'loot-core',
|
|
'parent',
|
|
'sibling',
|
|
'index',
|
|
'desktop-client',
|
|
],
|
|
customGroups: [
|
|
{
|
|
groupName: 'react',
|
|
elementNamePattern: '^react(-.*)?$',
|
|
},
|
|
{
|
|
groupName: 'loot-core',
|
|
elementNamePattern: '^loot-core',
|
|
},
|
|
{
|
|
groupName: 'desktop-client',
|
|
elementNamePattern: '^@desktop-client',
|
|
},
|
|
],
|
|
newlinesBetween: 'always',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ['packages/desktop-client/**/*.{js,ts,jsx,tsx}'],
|
|
plugins: {
|
|
'typescript-paths': pluginTypescriptPaths,
|
|
},
|
|
rules: {
|
|
'typescript-paths/absolute-parent-import': [
|
|
'error',
|
|
{ preferPathOverBaseUrl: true },
|
|
],
|
|
'typescript-paths/absolute-import': ['error', { enableAlias: false }],
|
|
},
|
|
},
|
|
);
|