-
Notifications
You must be signed in to change notification settings - Fork 2
linting #25
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
linting #25
Changes from all commits
1c071ea
7870416
c3b7897
a27742f
89aa295
436bd31
f439ef8
255d3e6
0c98c01
678e00b
77427a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||||||||||||||||||||||||||||||||||||||
| const js = require('@eslint/js'); | ||||||||||||||||||||||||||||||||||||||||||
| const globals = require('globals'); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| module.exports = [ | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| ignores: ['node_modules/**'], | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| js.configs.recommended, | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| files: ['**/*.js'], | ||||||||||||||||||||||||||||||||||||||||||
| languageOptions: { | ||||||||||||||||||||||||||||||||||||||||||
| ecmaVersion: 'latest', | ||||||||||||||||||||||||||||||||||||||||||
| sourceType: 'commonjs', | ||||||||||||||||||||||||||||||||||||||||||
| globals: { | ||||||||||||||||||||||||||||||||||||||||||
| ...globals.node, | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| rules: { | ||||||||||||||||||||||||||||||||||||||||||
| 'no-console': 'off', | ||||||||||||||||||||||||||||||||||||||||||
| 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], | ||||||||||||||||||||||||||||||||||||||||||
| camelcase: [ | ||||||||||||||||||||||||||||||||||||||||||
| 'warn', | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| properties: 'never', | ||||||||||||||||||||||||||||||||||||||||||
| ignoreDestructuring: true, | ||||||||||||||||||||||||||||||||||||||||||
| ignoreImports: true, | ||||||||||||||||||||||||||||||||||||||||||
| allow: ['^_$'], | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||
| 'func-names': ['warn', 'as-needed'], | ||||||||||||||||||||||||||||||||||||||||||
| 'id-match': [ | ||||||||||||||||||||||||||||||||||||||||||
| 'warn', | ||||||||||||||||||||||||||||||||||||||||||
| '^_?(?:[a-z][a-zA-Z0-9]*|[A-Z][a-zA-Z0-9]*)$', | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| onlyDeclarations: true, | ||||||||||||||||||||||||||||||||||||||||||
| properties: false, | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||
| 'no-restricted-syntax': [ | ||||||||||||||||||||||||||||||||||||||||||
| 'warn', | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| selector: "FunctionDeclaration[id.name!=/^[A-Z][a-zA-Z0-9]*$/]", | ||||||||||||||||||||||||||||||||||||||||||
| message: 'Function names must be PascalCase like NewFont.', | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| selector: "VariableDeclarator[init.type='ArrowFunctionExpression'][id.type='Identifier'][id.name!=/^[A-Z][a-zA-Z0-9]*$/]", | ||||||||||||||||||||||||||||||||||||||||||
| message: 'Function names must be PascalCase like NewFont.', | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| selector: "VariableDeclarator[init.type='FunctionExpression'][id.type='Identifier'][id.name!=/^[A-Z][a-zA-Z0-9]*$/]", | ||||||||||||||||||||||||||||||||||||||||||
| message: 'Function names must be PascalCase like NewFont.', | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+42
to
+51
|
||||||||||||||||||||||||||||||||||||||||||
| selector: "FunctionDeclaration[id.name!=/^[A-Z][a-zA-Z0-9]*$/]", | |
| message: 'Function names must be PascalCase like NewFont.', | |
| }, | |
| { | |
| selector: "VariableDeclarator[init.type='ArrowFunctionExpression'][id.type='Identifier'][id.name!=/^[A-Z][a-zA-Z0-9]*$/]", | |
| message: 'Function names must be PascalCase like NewFont.', | |
| }, | |
| { | |
| selector: "VariableDeclarator[init.type='FunctionExpression'][id.type='Identifier'][id.name!=/^[A-Z][a-zA-Z0-9]*$/]", | |
| message: 'Function names must be PascalCase like NewFont.', | |
| selector: "FunctionDeclaration[id.name!=/^_?[a-z][a-zA-Z0-9]*$/]", | |
| message: 'Function names must be camelCase like connectDB.', | |
| }, | |
| { | |
| selector: "VariableDeclarator[init.type='ArrowFunctionExpression'][id.type='Identifier'][id.name!=/^_?[a-z][a-zA-Z0-9]*$/]", | |
| message: 'Function names must be camelCase like connectDB.', | |
| }, | |
| { | |
| selector: "VariableDeclarator[init.type='FunctionExpression'][id.type='Identifier'][id.name!=/^_?[a-z][a-zA-Z0-9]*$/]", | |
| message: 'Function names must be camelCase like connectDB.', |
Copilot
AI
Apr 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id-match currently allows both camelCase and PascalCase declarations, but later no-restricted-syntax enforces PascalCase for function identifiers. This combination is contradictory and will produce widespread warnings across the backend (most functions are currently camelCase). Align these rules (e.g., enforce camelCase, or allow both) and remove the redundant rule to avoid noisy lint output.
| 'no-restricted-syntax': [ | |
| 'warn', | |
| { | |
| selector: "FunctionDeclaration[id.name!=/^[A-Z][a-zA-Z0-9]*$/]", | |
| message: 'Function names must be PascalCase like NewFont.', | |
| }, | |
| { | |
| selector: "VariableDeclarator[init.type='ArrowFunctionExpression'][id.type='Identifier'][id.name!=/^[A-Z][a-zA-Z0-9]*$/]", | |
| message: 'Function names must be PascalCase like NewFont.', | |
| }, | |
| { | |
| selector: "VariableDeclarator[init.type='FunctionExpression'][id.type='Identifier'][id.name!=/^[A-Z][a-zA-Z0-9]*$/]", | |
| message: 'Function names must be PascalCase like NewFont.', | |
| }, | |
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conflicting rules:
camelcasevsno-restricted-syntaxfor functions.There's a direct conflict between these rules:
camelcase(lines 21-29) enforces camelCase for identifiersno-restricted-syntax(lines 39-53) requires PascalCase for all functionsThese rules will fight each other on function names. Additionally, PascalCase for regular functions is unconventional in JavaScript—it's typically reserved for classes and constructor functions.
From the context snippets, all existing controller functions (
deployFlow,buildArchivePayload,syncArchiveByRoomId,getRoomUsers,emitRoomUsers) use camelCase and will trigger warnings.Proposed fix: Remove PascalCase function requirement
Also applies to: 39-53
🤖 Prompt for AI Agents