Skip to content
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

Migrating from eslintrc.json to eslint.config.js #2660

Merged
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bae223d
performing the migration
Suyash878 Dec 14, 2024
cf2bf9f
performing the migration
Suyash878 Dec 14, 2024
b29d1a4
Merge branch 'issue#2645' of https://github.com/Suyash878/talawa-admi…
Suyash878 Dec 14, 2024
d56b259
Update eslint.config.mjs
Suyash878 Dec 14, 2024
6c52fc6
adding globals package
Suyash878 Dec 14, 2024
cf1714d
Merge branch 'issue#2645' of https://github.com/Suyash878/talawa-admi…
Suyash878 Dec 14, 2024
d089b64
fixing linting errors
Suyash878 Dec 14, 2024
b12b94f
Apply suggestions from code review
Suyash878 Dec 17, 2024
6adc55d
Merge branch 'develop-postgres' into issue#2645
Suyash878 Dec 17, 2024
5e9c6da
Merge branch 'develop-postgres' into issue#2645
Suyash878 Dec 21, 2024
a4d770e
Excluding L15-L17 from codeCov
Suyash878 Dec 21, 2024
1e1bec7
Merge branch 'develop-postgres' into issue#2645
palisadoes Dec 24, 2024
f1f943c
refactoring the config file and updating package-lock.json
Suyash878 Dec 29, 2024
8021ea1
re-making eslintrc.json and eslintignore to resolve conflicts
Suyash878 Dec 29, 2024
0641541
Merge branch 'develop-postgres' into issue#2645
Suyash878 Dec 29, 2024
7b54c25
adding @eslint/compat
Suyash878 Dec 29, 2024
d714f34
updating eslint.config.mjs
Suyash878 Dec 29, 2024
f4f5af0
upgrading eslint version to satisfy the peer deps for @eslint/compat
Suyash878 Dec 29, 2024
2035b91
updating globals package to resolve an error
Suyash878 Dec 29, 2024
8dca9cf
Merge branch 'develop-postgres' into issue#2645
palisadoes Dec 29, 2024
1189e20
Merge branch 'develop-postgres' into issue#2645
Suyash878 Dec 30, 2024
e6363f4
Adding test for eslint.config.mjs
Suyash878 Dec 30, 2024
1a6710e
fixing lint
Suyash878 Dec 30, 2024
18f8d81
linting fix
Suyash878 Dec 30, 2024
379f67b
fixing lint finally
Suyash878 Dec 30, 2024
b7281f4
fixing failing test
Suyash878 Dec 30, 2024
80067b5
removing eslintrc.json and eslintignore and adding test for eslint.co…
Suyash878 Dec 30, 2024
cb39776
Merge branch 'develop-postgres' into issue#2645
Suyash878 Dec 30, 2024
e93fbaa
refactoring eslint.config.js
Suyash878 Jan 3, 2025
4cc1e02
Merge branch 'issue#2645' of https://github.com/Suyash878/talawa-admi…
Suyash878 Jan 3, 2025
af0adba
Adding eslint.config.js to ignores property
Suyash878 Jan 5, 2025
75b3cd3
Adding suggestions from coderabbit
Suyash878 Jan 5, 2025
5b47969
removing the test
Suyash878 Jan 5, 2025
6669192
Update eslint.config.mjs
Suyash878 Jan 5, 2025
b264fa3
Update eslint.config.mjs
Suyash878 Jan 5, 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
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

157 changes: 0 additions & 157 deletions .eslintrc.json

This file was deleted.

215 changes: 215 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
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';

export function createESLintCompat() {
const _filename = fileURLToPath(import.meta.url);
const _dirname = path.dirname(_filename);

return new FlatCompat({
baseDirectory: _dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
}
Suyash878 marked this conversation as resolved.
Show resolved Hide resolved

const compat = createESLintCompat();
export default [
{
ignores: [
'**/*.css',
'**/*.scss',
'**/*.less',
'**/*.json',
'**/*.svg',
'docs/docusaurus.config.ts',
'docs/sidebars.ts',
'docs/src/**/*',
'docs/blog/**/*',
'src/components/CheckIn/tagTemplate.ts',
'**/package.json',
'**/package-lock.json',
'**/tsconfig.json',
'docs/**/*',
// 'eslint.config.mjs'
],
},
...compat.extends(
'plugin:react/recommended',
'eslint:recommended',
'plugin:jest/recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
'eslint-config-prettier',
'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',
},
},
{
files: ['eslint.config.mjs'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
];
Loading
Loading