Skip to content

Eslint config upgrade to 10.0.2 #3801

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

Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
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
176 changes: 98 additions & 78 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,129 +1,149 @@
import js from "@eslint/js";
import ts from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import react from "eslint-plugin-react";
import prettier from "eslint-plugin-prettier"; // Import naming changed for clarity
import vitest from "eslint-plugin-vitest";
import tsdoc from "eslint-plugin-tsdoc";
import graphql from "@graphql-eslint/eslint-plugin";
import imports from "eslint-plugin-import";
import js from '@eslint/js';
import ts from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import react from 'eslint-plugin-react';
import prettier from 'eslint-plugin-prettier'; // Import naming changed for clarity
import vitest from 'eslint-plugin-vitest';
import tsdoc from 'eslint-plugin-tsdoc';
import graphql from '@graphql-eslint/eslint-plugin';
import imports from 'eslint-plugin-import';

export default [
{
ignores: [
"node_modules",
"dist",
"build",
"package.json",
"package-lock.json",
"tsconfig.json",
"fix-readme-links.js",
"fix-repo-url.js",
"src/components/CheckIn/tagTemplate.ts",
"docs/**",
"*.md",
"docker/**",
"config/docker/setup/nginx*.conf",
"**/*.css",
"**/*.scss",
"**/*.less",
"**/*.json",
"**/*.svg"
'node_modules',
'dist',
'build',
'package.json',
'package-lock.json',
'tsconfig.json',
'fix-repo-url.js',
'src/components/CheckIn/tagTemplate.ts',
'docs/**',
'*.md',
'docker/**',
'config/docker/setup/nginx*.conf',
'**/*.css',
'**/*.scss',
'**/*.less',
'**/*.json',
'**/*.svg',
'schema.graphql',
],
},
{
files: ["*.ts", "*.tsx"],
files: ['*.ts', '*.tsx'],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaVersion: 'latest',
sourceType: 'module',
parser: tsParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
window: "readonly",
localStorage: "readonly",
setTimeout: "readonly",
window: 'readonly',
localStorage: 'readonly',
setTimeout: 'readonly',
console: 'readonly', // Add console as a global variable
beforeAll: 'readonly',
afterEach: 'readonly',
afterAll: 'readonly',
},
},
plugins: {
react,
"@typescript-eslint": ts,
'@typescript-eslint': ts,
vitest,
tsdoc,
"@graphql-eslint": graphql,
'@graphql-eslint': graphql,
import: imports,
prettier,
},
settings: {
react: {
version: "detect",
version: 'detect',
},
},
rules: {
...js.configs.recommended.rules,
...ts.configs.recommended.rules,
"react/destructuring-assignment": "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-non-null-assertion": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/naming-convention": [
"error",
{ selector: "interface", format: ["PascalCase"], prefix: ["I"] },
{ 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/destructuring-assignment': '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-non-null-assertion': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/naming-convention': [
'error',
{ selector: 'interface', format: ['PascalCase'], prefix: ['I'] },
{ 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-pascal-case": ["error", { allowAllCaps: false, allowNamespace: false }],
"react/no-this-in-sfc": "error",
"react/no-unstable-nested-components": ["error", { allowAsProps: true }],
"prettier/prettier": "error", // This rule should now work correctly
"vitest/no-disabled-tests": "warn",
"vitest/no-focused-tests": "error",
"vitest/no-identical-title": "error",
"@typescript-eslint/no-unused-expressions": "error",
'react/no-this-in-sfc': 'error',
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
'prettier/prettier': 'error', // This rule should now work correctly
'vitest/no-disabled-tests': 'warn',
'vitest/no-focused-tests': 'error',
'vitest/no-identical-title': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
},
},
{
files: ["*.spec.ts", "*.test.ts", "*.spec.tsx", "*.test.tsx"],
files: ['*.spec.ts', '*.test.ts', '*.spec.tsx', '*.test.tsx'],
languageOptions: {
globals: {
describe: "readonly",
test: "readonly",
expect: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
describe: 'readonly',
test: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
},
},
},
{
files: ["*.graphql"],
files: ['*.graphql'],
languageOptions: {
parser: graphql.parser,
},
plugins: {
"@graphql-eslint": graphql,
'@graphql-eslint': graphql,
prettier,
},
rules: {
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@graphql-eslint/known-type-names": "error",
"@graphql-eslint/no-unreachable-types": "off",
"prettier/prettier": ["error", { endOfLine: "auto" }],
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@graphql-eslint/known-type-names': 'error',
'@graphql-eslint/no-unreachable-types': 'off',
'prettier/prettier': ['error', { endOfLine: 'auto' }],
},
},
];
4 changes: 2 additions & 2 deletions fix-readme-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
let content = fs.readFileSync(filePath, 'utf8');

// Replace any README.md links with root directory ("/")
content = content.replace(/\[.*?\]\((.*?)README\.md\)/g, (match) => {
return '[Admin Docs](/)'; // Redirect broken links to the root
content = content.replace(/\[.*?\]\((.*?)README\.md\)/g, () => {
return '[Admin Docs](/)';

Check warning on line 17 in fix-readme-links.js

View check run for this annotation

Codecov / codecov/patch

fix-readme-links.js#L16-L17

Added lines #L16 - L17 were not covered by tests
});

fs.writeFileSync(filePath, content, 'utf8');
Expand Down
Loading
Loading