The require-platform-declaration rule is working correctly from the command line:
$ npx eslint lib/core/custom_attribute_condition_evaluator/index.ts
lib/core/custom_attribute_condition_evaluator/index.ts
16:1 error File must export __platforms to declare which platforms
it supports. Example: export const __platforms = ['__universal__'] as const;If VSCode isn't showing the ESLint errors, try these steps:
- Open Command Palette:
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Type:
ESLint: Restart ESLint Server - Press Enter
- Open Extensions panel:
Cmd+Shift+X(Mac) orCtrl+Shift+X(Windows/Linux) - Search for "ESLint" by Microsoft
- Make sure it's installed and enabled
- Open Output panel:
Cmd+Shift+U(Mac) orCtrl+Shift+U(Windows/Linux) - Select "ESLint" from the dropdown
- Look for any error messages
- Open Command Palette:
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Type:
Developer: Reload Window - Press Enter
The rule only applies to:
- ✅ Files in
lib/orsrc/directory - ✅ TypeScript files (
.ts) - ❌ Test files (
.spec.ts,.test.ts, etc.) - ❌ Declaration files (
.d.ts)
Check that .eslintrc.js has the parser set:
parser: '@typescript-eslint/parser',And that the rule is in the overrides:
overrides: [{
files: ['*.ts', '!*.spec.ts', '!*.test.ts', '!*.tests.ts', '!*.test-d.ts'],
rules: {
'local-rules/require-platform-declaration': 'error',
}
}]You can always verify the rule works by running:
# Check a specific file
npx eslint lib/service.ts
# Check all lib files (shows only errors)
npx eslint lib/**/*.ts --quietTo fix the error, add this export to your file (after imports):
// Universal file (all platforms)
export const __platforms = ['__universal__'] as const;
// OR platform-specific file
export const __platforms = ['browser', 'node'] as const;