WS-3 session 1b-ii Task 3 (audit Bucket B — 34 items: 21 absorbed
via ignorePatterns + 14 real fixes; the count of 21 is the actual
non-Tier-3 lint-count drop from the .eslintrc edit, slightly above
the audit's predicted 20 because additional vendored-Vuexy items
beyond the 23 no-explicit-any landed in those paths too).
Config:
- .eslintrc.cjs: add src/@core/** and src/@layouts/** to ignorePatterns.
Vendored Vuexy code, precedent: src/plugins/iconify/*.js. The
CLAUDE.md no-any rule remains in force for our own code under src/.
Real type-safety fixes:
- B.1 ref<any> in our code (3 occurrences):
* blank.vue / default.vue: AppLoadingIndicator template ref now
typed as InstanceType<typeof AppLoadingIndicator> | null. Picks
up the defineExpose'd fallbackHandle / resolveHandle methods.
* NavSearchBar.vue:109: useApi<any>(...) → useApi<SearchResults[]>(...)
matching the existing searchResult ref type.
- B.2 ShiftDetailPanel.vue: moved the Cancel-dialog ref declarations
(isCancelDialogOpen, cancellingAssignment) from line 305-307 to
line 248 — directly above the onCancel handler that uses them.
Resolves all 7 no-use-before-define items in one move. Same-file,
no logic change.
- B.3 useImpersonationStore.ts:119: renamed inner 'stored' to
'storedSnapshot' to resolve shadowing of the outer 'stored' on
line 18.
- B.4 useFormSchemas.ts:97-99: renamed local mutationFn parameter
'confirmed_name' to camelCase 'confirmedName'. Wire-format key
stays snake_case via destructure-alias:
params: confirmedName ? { confirmed_name: confirmedName } : undefined
No callers found in apps/app/src — safe rename.
Tests + typecheck verified green.
Lint baseline: 97 → 62.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
211 lines
6.2 KiB
JavaScript
211 lines
6.2 KiB
JavaScript
// Sessie 3c (WS-6) — closes the apps/app ESLint config gap.
|
|
// Adapted from the Vuexy reference (resources/vuexy-admin-v10.11.1/.../full-version/.eslintrc.cjs)
|
|
// minus the Vuexy-internal lint rules (valid-appcardcode-*, internal regex
|
|
// rules) that don't apply outside the demo project. Plugin set matches
|
|
// what's installed in apps/app's package.json.
|
|
module.exports = {
|
|
root: true,
|
|
env: {
|
|
browser: true,
|
|
node: true,
|
|
es2022: true,
|
|
},
|
|
extends: [
|
|
'@antfu/eslint-config-vue',
|
|
'plugin:vue/vue3-recommended',
|
|
'plugin:import/recommended',
|
|
'plugin:import/typescript',
|
|
'plugin:promise/recommended',
|
|
'plugin:sonarjs/recommended',
|
|
'plugin:@typescript-eslint/recommended',
|
|
'plugin:case-police/recommended',
|
|
'plugin:regexp/recommended',
|
|
],
|
|
parser: 'vue-eslint-parser',
|
|
parserOptions: {
|
|
ecmaVersion: 13,
|
|
parser: '@typescript-eslint/parser',
|
|
sourceType: 'module',
|
|
},
|
|
plugins: [
|
|
'vue',
|
|
'@typescript-eslint',
|
|
'regex',
|
|
'regexp',
|
|
],
|
|
ignorePatterns: [
|
|
'src/plugins/iconify/*.js',
|
|
'node_modules',
|
|
'dist',
|
|
'*.d.ts',
|
|
'vendor',
|
|
'*.json',
|
|
'src/@core/**',
|
|
'src/@layouts/**',
|
|
],
|
|
rules: {
|
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
|
|
'comma-spacing': ['error', { before: false, after: true }],
|
|
'key-spacing': ['error', { afterColon: true }],
|
|
'n/prefer-global/process': ['off'],
|
|
'sonarjs/cognitive-complexity': ['off'],
|
|
|
|
'vue/first-attribute-linebreak': ['error', {
|
|
singleline: 'beside',
|
|
multiline: 'below',
|
|
}],
|
|
|
|
'antfu/top-level-function': 'off',
|
|
|
|
// Project rule (CLAUDE.md frontend rules): no `any`. Override the
|
|
// Vuexy reference (which sets this off) — Crewli's stricter posture.
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
|
|
'indent': ['error', 2],
|
|
'comma-dangle': ['error', 'always-multiline'],
|
|
'object-curly-spacing': ['error', 'always'],
|
|
'camelcase': 'error',
|
|
'max-len': 'off',
|
|
'semi': ['error', 'never'],
|
|
'arrow-parens': ['error', 'as-needed'],
|
|
'newline-before-return': 'error',
|
|
|
|
'lines-around-comment': [
|
|
'error',
|
|
{
|
|
beforeBlockComment: true,
|
|
beforeLineComment: true,
|
|
allowBlockStart: true,
|
|
allowClassStart: true,
|
|
allowObjectStart: true,
|
|
allowArrayStart: true,
|
|
ignorePattern: '!SECTION',
|
|
},
|
|
],
|
|
|
|
'@typescript-eslint/no-unused-vars': ['error', {
|
|
varsIgnorePattern: '^_+$',
|
|
argsIgnorePattern: '^_+$',
|
|
}],
|
|
|
|
'array-element-newline': ['error', 'consistent'],
|
|
'array-bracket-newline': ['error', 'consistent'],
|
|
|
|
'vue/multi-word-component-names': 'off',
|
|
|
|
'padding-line-between-statements': [
|
|
'error',
|
|
{ blankLine: 'always', prev: 'expression', next: 'const' },
|
|
{ blankLine: 'always', prev: 'const', next: 'expression' },
|
|
{ blankLine: 'always', prev: 'multiline-const', next: '*' },
|
|
{ blankLine: 'always', prev: '*', next: 'multiline-const' },
|
|
],
|
|
|
|
'import/prefer-default-export': 'off',
|
|
'import/newline-after-import': ['error', { count: 1 }],
|
|
'no-restricted-imports': ['error', 'vuetify/components', {
|
|
name: 'vue3-apexcharts',
|
|
message: 'apexcharts are auto imported',
|
|
}],
|
|
|
|
'import/extensions': [
|
|
'error',
|
|
'ignorePackages',
|
|
{
|
|
js: 'never',
|
|
jsx: 'never',
|
|
ts: 'never',
|
|
tsx: 'never',
|
|
},
|
|
],
|
|
|
|
'import/no-unresolved': [2, {
|
|
ignore: [
|
|
'~pages$',
|
|
'virtual:meta-layouts',
|
|
'#auth$',
|
|
'#components$',
|
|
'.*\\?raw',
|
|
],
|
|
}],
|
|
|
|
'no-shadow': 'off',
|
|
'@typescript-eslint/no-shadow': ['error'],
|
|
'@typescript-eslint/consistent-type-imports': 'error',
|
|
|
|
// CLAUDE.md frontend convention — backend enums are mirrored as
|
|
// `as const` objects WITH a same-named `type` alias. The two live
|
|
// in different namespaces (value vs. type) and are intentional;
|
|
// both base `no-redeclare` and the typed variant flag them anyway.
|
|
'no-redeclare': 'off',
|
|
'@typescript-eslint/no-redeclare': 'off',
|
|
|
|
'promise/always-return': 'off',
|
|
'promise/catch-or-return': 'off',
|
|
|
|
'vue/block-tag-newline': 'error',
|
|
'vue/component-api-style': 'error',
|
|
'vue/component-name-in-template-casing': ['error', 'PascalCase', {
|
|
registeredComponentsOnly: false,
|
|
ignores: ['/^swiper-/'],
|
|
}],
|
|
'vue/custom-event-name-casing': ['error', 'camelCase', {
|
|
ignores: [
|
|
'/^(click):[a-z]+((\\d)|([A-Z0-9][a-z0-9]+))*([A-Z])?/',
|
|
],
|
|
}],
|
|
'vue/define-macros-order': 'error',
|
|
'vue/html-comment-content-newline': 'error',
|
|
'vue/html-comment-content-spacing': 'error',
|
|
'vue/html-comment-indent': 'error',
|
|
'vue/match-component-file-name': 'error',
|
|
'vue/no-child-content': 'error',
|
|
'vue/require-default-prop': 'off',
|
|
|
|
'vue/no-duplicate-attr-inheritance': 'error',
|
|
'vue/no-empty-component-block': 'error',
|
|
'vue/no-multiple-objects-in-class': 'error',
|
|
'vue/no-reserved-component-names': 'error',
|
|
'vue/no-template-target-blank': 'error',
|
|
'vue/no-useless-mustaches': 'error',
|
|
'vue/no-useless-v-bind': 'error',
|
|
'vue/padding-line-between-blocks': 'error',
|
|
'vue/prefer-separate-static-class': 'error',
|
|
'vue/prefer-true-attribute-shorthand': 'error',
|
|
'vue/v-on-function-call': 'error',
|
|
'vue/no-restricted-class': ['error', '/^(p|m)(l|r)-/'],
|
|
'vue/valid-v-slot': ['error', { allowModifiers: true }],
|
|
|
|
'vue/no-irregular-whitespace': 'error',
|
|
'vue/template-curly-spacing': 'error',
|
|
|
|
'sonarjs/no-duplicate-string': 'off',
|
|
'sonarjs/no-nested-template-literals': 'off',
|
|
|
|
'regex/invalid': [
|
|
'error',
|
|
[
|
|
{
|
|
regex: '@/assets/images',
|
|
replacement: '@images',
|
|
message: 'Use \'@images\' path alias for image imports',
|
|
},
|
|
{
|
|
regex: '@/assets/styles',
|
|
replacement: '@styles',
|
|
message: 'Use \'@styles\' path alias for importing styles from \'src/assets/styles\'',
|
|
},
|
|
],
|
|
'\\.eslintrc\\.cjs',
|
|
],
|
|
},
|
|
settings: {
|
|
'import/resolver': {
|
|
node: true,
|
|
typescript: {},
|
|
},
|
|
},
|
|
}
|