Skip to content

refactor: using eslint-config-neon on mainlib #10876

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

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0afbcc7
refactor: using eslint-config-neon on mainlib
Qjuh May 2, 2025
1fcd058
fix: lint
Qjuh May 2, 2025
5b7485b
fix: lint
Qjuh May 3, 2025
8353664
fix: the way we lint
Qjuh May 3, 2025
24f9fe8
chore: lint some more
Qjuh May 3, 2025
45dcff9
fix: more lint changes
Qjuh May 3, 2025
6b46d98
fix: type tests
Qjuh May 3, 2025
9bb0a5d
chore: port eslint rule
Qjuh May 3, 2025
99ab57d
refactor: lintstaged doesn't need this
Qjuh May 3, 2025
0e3e391
fix: eslint was a bit too eager
Qjuh May 3, 2025
04a2267
fix: forgot Client
Qjuh May 3, 2025
a58aeda
Apply suggestions from code review
Qjuh May 3, 2025
6e49718
chore: more lint fixes
Qjuh May 3, 2025
6945b0e
fix: remove useless Boolean()
Qjuh May 3, 2025
7d5d3b0
fix: get docs back
Qjuh May 4, 2025
c8687cd
fix: snowflake docs
Qjuh May 4, 2025
0eaeb72
refactor: don't use typescript lint rules
Qjuh May 4, 2025
9e7644f
fix: code review
Qjuh May 4, 2025
4bf9089
fix: tidy up disabled rules
Qjuh May 4, 2025
5da6f14
chore: code review
Qjuh May 4, 2025
e80a440
chore: code review
Qjuh May 4, 2025
0f1a763
chore: code review
Qjuh May 4, 2025
ee24624
fix: consistent spacing in typings
Qjuh May 4, 2025
23c5e7b
fix: tests
Qjuh May 4, 2025
5b56c4f
fix: unsort ErrorCodes
Qjuh May 4, 2025
5d3a393
chore: get comments back
Qjuh May 4, 2025
b1dd831
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 4, 2025
6c0f714
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 7, 2025
158c588
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 9, 2025
2b552e6
Update packages/discord.js/src/client/websocket/handlers/THREAD_LIST_…
Qjuh May 9, 2025
6c4cfc5
fix: remove unused parameter
Qjuh May 12, 2025
4f3a5c0
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 12, 2025
74e2553
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 12, 2025
1a0ab7f
fix: merge messed up types
Qjuh May 13, 2025
0323177
fix: more type mess from merge
Qjuh May 13, 2025
6a22874
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 13, 2025
a834577
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 16, 2025
efa0ee0
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 16, 2025
d63c91b
fix: generate script for ActionsManager
Qjuh May 25, 2025
5e0562e
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 25, 2025
0753791
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 25, 2025
da5520e
fix: code review
Qjuh May 25, 2025
3789ab0
Update packages/discord.js/src/structures/MessageMentions.js
Qjuh May 25, 2025
0f32ab1
Update packages/discord.js/src/structures/Presence.js
Qjuh May 25, 2025
a460ad4
fix: replace is faster, unicorn is wrong
Qjuh May 26, 2025
437660d
fix: consistency
Qjuh May 26, 2025
7950a89
fix: delete obsolete file
Qjuh May 26, 2025
28dae57
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 26, 2025
42c5761
fix: minor nit in test file
Qjuh May 26, 2025
6260282
Merge branch 'main' into refactor/eslint-neon-mainlib
Qjuh May 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 96 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const nodeRuleset = merge(...node, { files: [`**/*${commonFiles}`] });

const typeScriptRuleset = merge(...typescript, {
files: [`**/*${commonFiles}`],
ignores: [`packages/discord.js/**/*.{js,mjs,cjs}`],
languageOptions: {
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
Expand Down Expand Up @@ -88,7 +89,6 @@ export default tseslint.config(
'**/storybook-static/',
'**/.next/',
'**/shiki.bundle.ts',
'packages/discord.js/',
],
},
commonRuleset,
Expand Down Expand Up @@ -137,6 +137,101 @@ export default tseslint.config(
'@typescript-eslint/no-empty-object-type': 0,
},
},
{
files: [`packages/discord.js/**/*{js,mjs,cjs}`],
languageOptions: {
sourceType: 'commonjs',
parserOptions: {
ecmaFeatures: {
impliedStrict: false,
},
},
},
settings: {
jsdoc: {
tagNamePreference: {
augments: 'extends',
fires: 'emits',
function: 'method',
},
preferredTypes: {
object: 'Object',
null: 'void',
},
},
},
rules: {
'jsdoc/no-undefined-types': 0,
'jsdoc/no-defaults': 0,
'no-eq-null': 0,
strict: ['error', 'global'],

'no-restricted-syntax': [
'error',
{
selector: "AssignmentExpression[left.object.name='module'][left.property.name='exports']",
message: 'Use named exports instead of module.exports',
},
{
selector:
"VariableDeclarator[init.callee.name='require'][init.arguments.0.value=/^\\./]:not([id.type='ObjectPattern'])",
message: 'Use object destructuring when requiring local modules',
},
],
},
},
{
files: [`packages/discord.js/src/client/websocket/handlers/*.js`],
rules: {
'no-restricted-syntax': [
'error',
{
selector:
"VariableDeclarator[init.callee.name='require'][init.arguments.0.value=/^\\./]:not([id.type='ObjectPattern'])",
message: 'Use object destructuring when requiring local modules',
},
],
},
},
{
files: [`packages/discord.js/typings/*{d.ts,test-d.ts,d.mts,test-d.mts}`],
rules: {
'@typescript-eslint/no-unsafe-declaration-merging': 0,
'@typescript-eslint/no-empty-object-type': 0,
'@typescript-eslint/no-use-before-define': 0,
'@typescript-eslint/consistent-type-imports': 0,
'@stylistic/ts/lines-between-class-members': 0,
'no-restricted-syntax': [
2,
{
selector:
'MethodDefinition[key.name!=on][key.name!=once][key.name!=off] > TSEmptyBodyFunctionExpression > Identifier :not(TSTypeOperator[operator=readonly]) > TSArrayType',
message: 'Array parameters on methods must be readonly',
},
{
selector:
'MethodDefinition > TSEmptyBodyFunctionExpression > Identifier TSTypeReference > Identifier[name=Collection]',
message: 'Parameters of type Collection on methods must use ReadonlyCollection',
},
{
selector: 'TSDeclareFunction > Identifier :not(TSTypeOperator[operator=readonly]) > TSArrayType',
message: 'Array parameters on functions must be readonly',
},
{
selector: 'TSDeclareFunction Identifier TSTypeReference > Identifier[name=Collection]',
message: 'Parameters of type Collection on functions must use ReadonlyCollection',
},
{
selector: 'TSInterfaceDeclaration TSPropertySignature :not(TSTypeOperator[operator=readonly]) > TSArrayType',
message: 'Array properties on interfaces must be readonly',
},
{
selector: 'TSInterfaceDeclaration TSPropertySignature TSTypeReference > Identifier[name=Collection]',
message: 'Interface properties of type Collection must use ReadonlyCollection',
},
],
},
},
{
files: [`packages/rest/**/*${commonFiles}`],
rules: {
Expand Down
Loading