-
-
Notifications
You must be signed in to change notification settings - Fork 888
Migrating from eslintrc.json to eslint.config.js #2660
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
palisadoes
merged 35 commits into
PalisadoesFoundation:develop-postgres
from
Suyash878:issue#2645
Jan 5, 2025
Merged
Changes from 7 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
bae223d
performing the migration
Suyash878 cf2bf9f
performing the migration
Suyash878 b29d1a4
Merge branch 'issue#2645' of https://github.com/Suyash878/talawa-admi…
Suyash878 d56b259
Update eslint.config.mjs
Suyash878 6c52fc6
adding globals package
Suyash878 cf1714d
Merge branch 'issue#2645' of https://github.com/Suyash878/talawa-admi…
Suyash878 d089b64
fixing linting errors
Suyash878 b12b94f
Apply suggestions from code review
Suyash878 6adc55d
Merge branch 'develop-postgres' into issue#2645
Suyash878 5e9c6da
Merge branch 'develop-postgres' into issue#2645
Suyash878 a4d770e
Excluding L15-L17 from codeCov
Suyash878 1e1bec7
Merge branch 'develop-postgres' into issue#2645
palisadoes f1f943c
refactoring the config file and updating package-lock.json
Suyash878 8021ea1
re-making eslintrc.json and eslintignore to resolve conflicts
Suyash878 0641541
Merge branch 'develop-postgres' into issue#2645
Suyash878 7b54c25
adding @eslint/compat
Suyash878 d714f34
updating eslint.config.mjs
Suyash878 f4f5af0
upgrading eslint version to satisfy the peer deps for @eslint/compat
Suyash878 2035b91
updating globals package to resolve an error
Suyash878 8dca9cf
Merge branch 'develop-postgres' into issue#2645
palisadoes 1189e20
Merge branch 'develop-postgres' into issue#2645
Suyash878 e6363f4
Adding test for eslint.config.mjs
Suyash878 1a6710e
fixing lint
Suyash878 18f8d81
linting fix
Suyash878 379f67b
fixing lint finally
Suyash878 b7281f4
fixing failing test
Suyash878 80067b5
removing eslintrc.json and eslintignore and adding test for eslint.co…
Suyash878 cb39776
Merge branch 'develop-postgres' into issue#2645
Suyash878 e93fbaa
refactoring eslint.config.js
Suyash878 4cc1e02
Merge branch 'issue#2645' of https://github.com/Suyash878/talawa-admi…
Suyash878 af0adba
Adding eslint.config.js to ignores property
Suyash878 75b3cd3
Adding suggestions from coderabbit
Suyash878 5b47969
removing the test
Suyash878 6669192
Update eslint.config.mjs
Suyash878 b264fa3
Update eslint.config.mjs
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,196 @@ | ||
import react from 'eslint-plugin-react'; | ||
import typescriptEslint from '@typescript-eslint/eslint-plugin'; | ||
import jest from 'eslint-plugin-jest'; | ||
import _import from 'eslint-plugin-import'; | ||
import tsdoc from 'eslint-plugin-tsdoc'; | ||
import prettier from 'eslint-plugin-prettier'; | ||
import { fixupPluginRules } from '@eslint/compat'; | ||
import globals from 'globals'; | ||
import tsParser from '@typescript-eslint/parser'; | ||
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: [ | ||
'**/*.css', | ||
'**/*.scss', | ||
'**/*.less', | ||
'**/*.json', | ||
'src/components/CheckIn/tagTemplate.ts', | ||
'**/package.json', | ||
'**/package-lock.json', | ||
'**/tsconfig.json', | ||
], | ||
}, | ||
...compat.extends( | ||
'plugin:react/recommended', | ||
'eslint:recommended', | ||
'plugin:jest/recommended', | ||
'plugin:prettier/recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
), | ||
{ | ||
plugins: { | ||
react, | ||
'@typescript-eslint': typescriptEslint, | ||
jest, | ||
import: fixupPluginRules(_import), | ||
tsdoc, | ||
prettier, | ||
}, | ||
|
||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.node, | ||
Atomics: 'readonly', | ||
SharedArrayBuffer: 'readonly', | ||
}, | ||
|
||
parser: tsParser, | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
Suyash878 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
}, | ||
|
||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
|
||
rules: { | ||
'react/destructuring-assignment': 'error', | ||
'@typescript-eslint/explicit-module-boundary-types': 'error', | ||
|
||
'react/no-multi-comp': [ | ||
'error', | ||
{ | ||
ignoreStateless: false, | ||
}, | ||
], | ||
|
||
'react/jsx-filename-extension': [ | ||
'error', | ||
{ | ||
extensions: ['.tsx'], | ||
}, | ||
], | ||
|
||
'import/no-duplicates': 'error', | ||
'tsdoc/syntax': 'error', | ||
'@typescript-eslint/ban-ts-comment': 'error', | ||
'@typescript-eslint/no-unused-vars': 'error', | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'@typescript-eslint/no-inferrable-types': 'error', | ||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error', | ||
'@typescript-eslint/no-non-null-assertion': 'error', | ||
'@typescript-eslint/no-var-requires': 'error', | ||
'@typescript-eslint/no-unsafe-function-type': 'error', | ||
'@typescript-eslint/no-wrapper-object-types': 'error', | ||
'@typescript-eslint/no-empty-object-type': 'error', | ||
'@typescript-eslint/no-duplicate-enum-values': 'error', | ||
'@typescript-eslint/array-type': 'error', | ||
'@typescript-eslint/consistent-type-assertions': 'error', | ||
'@typescript-eslint/consistent-type-imports': 'error', | ||
|
||
'@typescript-eslint/explicit-function-return-type': [ | ||
2, | ||
{ | ||
allowExpressions: true, | ||
allowTypedFunctionExpressions: true, | ||
}, | ||
], | ||
|
||
camelcase: 'off', | ||
|
||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'interface', | ||
format: ['PascalCase'], | ||
prefix: ['Interface', 'TestInterface'], | ||
}, | ||
Suyash878 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
selector: ['typeAlias', 'typeLike', 'enum'], | ||
format: ['PascalCase'], | ||
}, | ||
{ | ||
selector: 'typeParameter', | ||
format: ['PascalCase'], | ||
prefix: ['T'], | ||
}, | ||
{ | ||
selector: 'variable', | ||
format: ['camelCase', 'UPPER_CASE', 'PascalCase'], | ||
leadingUnderscore: 'allow', | ||
}, | ||
{ | ||
selector: 'parameter', | ||
format: ['camelCase'], | ||
leadingUnderscore: 'allow', | ||
}, | ||
{ | ||
selector: 'function', | ||
format: ['camelCase', 'PascalCase'], | ||
}, | ||
{ | ||
selector: 'memberLike', | ||
modifiers: ['private'], | ||
format: ['camelCase'], | ||
leadingUnderscore: 'require', | ||
}, | ||
{ | ||
selector: 'variable', | ||
modifiers: ['exported'], | ||
format: null, | ||
}, | ||
], | ||
|
||
'react/jsx-pascal-case': [ | ||
'error', | ||
{ | ||
allowAllCaps: false, | ||
allowNamespace: false, | ||
}, | ||
], | ||
|
||
'react/jsx-equals-spacing': ['warn', 'never'], | ||
'react/no-this-in-sfc': 'error', | ||
'jest/expect-expect': 0, | ||
|
||
'react/no-unstable-nested-components': [ | ||
'error', | ||
{ | ||
allowAsProps: true, | ||
}, | ||
], | ||
|
||
'react/function-component-definition': [ | ||
0, | ||
{ | ||
namedComponents: 'function-declaration', | ||
}, | ||
], | ||
|
||
'prettier/prettier': 'error', | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.
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.