-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Migrating to eslint.config.js #2522
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
85500ed
Migrating to eslint.config.js
da726aa
Resolving conflicts
Suyash878 75ce817
Resolving Dependency conflict
Suyash878 7e13f82
Removing the dev and license keys to resolve conflict
Suyash878 cb4abc8
Removing the dev and license key for eslint/eslintrc
Suyash878 8999d55
Resolving the conflicts in the package.json file and modifying the es…
Suyash878 617d52b
resolving package conflicts
Suyash878 1dfa00c
Quoting the 'import' property name to avoid syntax errors
Suyash878 25a503d
Apply suggestions from code review
Suyash878 d49e4e3
Merge branch 'develop' into eslint
Suyash878 21baaad
bringing package-lock and package.json in sync
Suyash878 9eb04ed
Merge branch 'eslint' of https://github.com/Suyash878/talawa-api into…
Suyash878 15000f3
Updating package-lock.json
Suyash878 84e9a3a
Commiting coderabbitai suggestion
Suyash878 3bd7668
Merge branch 'develop' into eslint
Suyash878 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import typescriptEslint from "@typescript-eslint/eslint-plugin"; | ||
import tsdoc from "eslint-plugin-tsdoc"; | ||
import _import from "eslint-plugin-import"; | ||
import { fixupPluginRules } from "@eslint/compat"; | ||
import globals from "globals"; | ||
import tsParser from "@typescript-eslint/parser"; | ||
import parser from "@graphql-eslint/eslint-plugin"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}); | ||
|
||
export default [{ | ||
ignores: [ | ||
"**/.github", | ||
"**/.vscode", | ||
"**/build", | ||
"**/coverage", | ||
"**/node_modules", | ||
"src/types", | ||
"docs/Schema.md", | ||
], | ||
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"), { | ||
plugins: { | ||
"@typescript-eslint": typescriptEslint, | ||
tsdoc, | ||
import: fixupPluginRules(_import), | ||
Suyash878 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
|
||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
|
||
parser: tsParser, | ||
}, | ||
|
||
rules: { | ||
"no-restricted-imports": ["error", { | ||
patterns: ["**/src/**"], | ||
}], | ||
|
||
"import/no-duplicates": "error", | ||
"tsdoc/syntax": "error", | ||
"@typescript-eslint/ban-ts-comment": "error", | ||
"@typescript-eslint/ban-types": "error", | ||
"@typescript-eslint/no-duplicate-enum-values": "error", | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/no-non-null-asserted-optional-chain": "error", | ||
"@typescript-eslint/no-non-null-assertion": "error", | ||
"@typescript-eslint/no-var-requires": "error", | ||
}, | ||
}, { | ||
files: ["**/*.ts"], | ||
|
||
languageOptions: { | ||
parser: tsParser, | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
|
||
parserOptions: { | ||
project: "./tsconfig.json", | ||
tsconfigRootDir: ".", | ||
}, | ||
}, | ||
|
||
rules: { | ||
"@typescript-eslint/array-type": "error", | ||
"@typescript-eslint/consistent-type-assertions": "error", | ||
"@typescript-eslint/consistent-type-imports": "error", | ||
"@typescript-eslint/explicit-function-return-type": "error", | ||
|
||
"@typescript-eslint/naming-convention": ["error", { | ||
selector: "interface", | ||
format: ["PascalCase"], | ||
prefix: ["Interface", "TestInterface"], | ||
}, { | ||
selector: ["typeAlias", "typeLike", "enum"], | ||
format: ["PascalCase"], | ||
}, { | ||
selector: "typeParameter", | ||
format: ["PascalCase"], | ||
prefix: ["T"], | ||
}, { | ||
selector: "variable", | ||
format: ["camelCase", "UPPER_CASE"], | ||
leadingUnderscore: "allow", | ||
}, { | ||
selector: "parameter", | ||
format: ["camelCase"], | ||
leadingUnderscore: "allow", | ||
}, { | ||
selector: "function", | ||
format: ["camelCase"], | ||
}, { | ||
selector: "memberLike", | ||
modifiers: ["private"], | ||
format: ["camelCase"], | ||
leadingUnderscore: "require", | ||
}, { | ||
selector: "variable", | ||
modifiers: ["exported"], | ||
format: null, | ||
}], | ||
}, | ||
}, { | ||
files: ["./src/typeDefs/**/*.ts"], | ||
processor: "@graphql-eslint/graphql", | ||
}, { | ||
files: ["./src/typeDefs/**/*.graphql"], | ||
|
||
plugins: { | ||
"@graphql-eslint": graphqlEslint, | ||
}, | ||
Suyash878 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
languageOptions: { | ||
parser: parser, | ||
}, | ||
}, { | ||
files: ["tests/**/*"], | ||
|
||
rules: { | ||
"no-restricted-imports": "off", | ||
}, | ||
}, { | ||
files: ["./src/index.ts", "./src/utilities/copyToClipboard.ts"], | ||
|
||
rules: { | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
}, | ||
}]; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.