mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-01-10 23:28:01 -05:00
upgrading eslint 🪢
This commit is contained in:
@@ -1 +0,0 @@
|
||||
.eslintrc.cjs
|
||||
@@ -1,86 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: [
|
||||
'airbnb-base',
|
||||
'airbnb-typescript/base',
|
||||
'airbnb/hooks',
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:jest/recommended',
|
||||
'prettier',
|
||||
],
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir: __dirname,
|
||||
ecmaVersion: 6,
|
||||
},
|
||||
ignorePatterns: [
|
||||
'**/codegen.ts',
|
||||
'**/next.config.mjs',
|
||||
'**/vite.config.ts',
|
||||
'**/jest.config.js',
|
||||
],
|
||||
plugins: ['simple-import-sort'],
|
||||
settings: {
|
||||
'import/resolver': { typescript: {} },
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
|
||||
// Doesn't work for FC: https://github.com/yannickcr/eslint-plugin-react/issues/2353
|
||||
'react/prop-types': 'off',
|
||||
|
||||
// Prefer non-default exports
|
||||
'import/no-default-export': 'off',
|
||||
'import/prefer-default-export': 'off',
|
||||
|
||||
// Auto-sort imports
|
||||
'sort-imports': 'off',
|
||||
'import/order': 'off',
|
||||
'simple-import-sort/imports': 'error',
|
||||
'simple-import-sort/exports': 'error',
|
||||
|
||||
// unary operators are ok
|
||||
'no-plusplus': 'off',
|
||||
|
||||
// Using a type system makes it safe enough to spread props
|
||||
'react/jsx-props-no-spreading': 'off',
|
||||
|
||||
// we want to be able to use functions before definition
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'error',
|
||||
{
|
||||
'ts-expect-error': 'allow-with-description',
|
||||
minimumDescriptionLength: 5,
|
||||
},
|
||||
],
|
||||
'no-bitwise': 'off',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
// assuming Next.js application
|
||||
files: '**/pages/**/*.{ts,tsx}',
|
||||
rules: {
|
||||
'react/react-in-jsx-scope': 'off', // react is a global in this folder
|
||||
'import/no-default-export': 'off', // pages have to have a default export
|
||||
'import/prefer-default-export': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': [
|
||||
// So we can infer prop types
|
||||
'warn',
|
||||
{ allowedNames: ['getStaticProps'] },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.stories.*'],
|
||||
rules: {
|
||||
// Storybook requires default exports for stories
|
||||
'import/no-default-export': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
};
|
||||
178
eslint.config.js
Normal file
178
eslint.config.js
Normal file
@@ -0,0 +1,178 @@
|
||||
import { includeIgnoreFile } from "@eslint/compat";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
// import simpleImportSort from "eslint-plugin-simple-import-sort";
|
||||
import eslint from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const gitignorePath = path.resolve(__dirname, ".gitignore");
|
||||
|
||||
export default tseslint.config(
|
||||
eslint.configs.recommended,
|
||||
// ...tseslint.configs.strictTypeChecked,
|
||||
...tseslint.configs.recommendedTypeChecked,
|
||||
...tseslint.configs.stylisticTypeChecked,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'],
|
||||
tsconfigRootDir: __dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
includeIgnoreFile(gitignorePath),
|
||||
{
|
||||
ignores: [
|
||||
'.prettierrc.cjs',
|
||||
'**/*.mjs', // scripts
|
||||
'**/codegen.ts',
|
||||
]
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
||||
'@typescript-eslint/consistent-type-definitions': 'warn',
|
||||
// '@typescript-eslint/explicit-function-return-type': 'off',
|
||||
|
||||
// // Doesn't work for FC: https://github.com/yannickcr/eslint-plugin-react/issues/2353
|
||||
// 'react/prop-types': 'off',
|
||||
|
||||
// // Prefer non-default exports
|
||||
// 'import/no-default-export': 'off',
|
||||
// 'import/prefer-default-export': 'off',
|
||||
|
||||
// Unary operators are ok
|
||||
'no-plusplus': 'off',
|
||||
|
||||
// // Using a type system makes it safe enough to spread props
|
||||
// 'react/jsx-props-no-spreading': 'off',
|
||||
|
||||
// // We want to be able to use functions before definition
|
||||
// '@typescript-eslint/no-use-before-define': 'off',
|
||||
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'error',
|
||||
{
|
||||
'ts-expect-error': 'allow-with-description',
|
||||
minimumDescriptionLength: 5,
|
||||
},
|
||||
],
|
||||
'no-bitwise': 'off',
|
||||
},
|
||||
},
|
||||
// {
|
||||
// files: ['**/pages/**/*.{ts,tsx}'],
|
||||
// rules: {
|
||||
// 'react/react-in-jsx-scope': 'off', // react is a global in this folder
|
||||
// 'import/no-default-export': 'off', // pages have to have a default export
|
||||
// 'import/prefer-default-export': 'off',
|
||||
// '@typescript-eslint/explicit-module-boundary-types': [
|
||||
// // So we can infer prop types
|
||||
// 'warn',
|
||||
// { allowedNames: ['getStaticProps'] },
|
||||
// ],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// files: ['**/*.stories.*'],
|
||||
// rules: {
|
||||
// // Storybook requires default exports for stories
|
||||
// 'import/no-default-export': 'off',
|
||||
// '@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
// },
|
||||
// },
|
||||
)
|
||||
|
||||
|
||||
// export default [
|
||||
// {
|
||||
// root: true,
|
||||
// extends: [
|
||||
// // doesn't support EWSLint v9: https://github.com/airbnb/javascript/issues/2961
|
||||
// // 'airbnb-base',
|
||||
// // 'airbnb-typescript/base',
|
||||
// // 'airbnb/hooks',
|
||||
// 'plugin:@typescript-eslint/eslint-recommended',
|
||||
// 'plugin:@typescript-eslint/recommended',
|
||||
// 'plugin:jest/recommended',
|
||||
// 'prettier',
|
||||
// ],
|
||||
// parserOptions: {
|
||||
// project: 'tsconfig.json',
|
||||
// tsconfigRootDir: __dirname,
|
||||
// ecmaVersion: 6,
|
||||
// },
|
||||
// ignorePatterns: [
|
||||
// '**/codegen.ts',
|
||||
// '**/next.config.mjs',
|
||||
// '**/vite.config.ts',
|
||||
// '**/jest.config.js',
|
||||
// ],
|
||||
// plugins: { 'simple-import-sort': simpleImportSort },
|
||||
// settings: {
|
||||
// 'import/resolver': { typescript: {} },
|
||||
// },
|
||||
// rules: {
|
||||
// '@typescript-eslint/explicit-function-return-type': 'off',
|
||||
|
||||
// // Doesn't work for FC: https://github.com/yannickcr/eslint-plugin-react/issues/2353
|
||||
// 'react/prop-types': 'off',
|
||||
|
||||
// // Prefer non-default exports
|
||||
// 'import/no-default-export': 'off',
|
||||
// 'import/prefer-default-export': 'off',
|
||||
|
||||
// // Auto-sort imports
|
||||
// 'sort-imports': 'off',
|
||||
// 'import/order': 'off',
|
||||
// 'simple-import-sort/imports': 'error',
|
||||
// 'simple-import-sort/exports': 'error',
|
||||
|
||||
// // unary operators are ok
|
||||
// 'no-plusplus': 'off',
|
||||
|
||||
// // Using a type system makes it safe enough to spread props
|
||||
// 'react/jsx-props-no-spreading': 'off',
|
||||
|
||||
// // we want to be able to use functions before definition
|
||||
// '@typescript-eslint/no-use-before-define': 'off',
|
||||
|
||||
// '@typescript-eslint/ban-ts-comment': [
|
||||
// 'error',
|
||||
// {
|
||||
// 'ts-expect-error': 'allow-with-description',
|
||||
// minimumDescriptionLength: 5,
|
||||
// },
|
||||
// ],
|
||||
// 'no-bitwise': 'off',
|
||||
// },
|
||||
// overrides: [
|
||||
// {
|
||||
// // assuming Next.js application
|
||||
// files: '**/pages/**/*.{ts,tsx}',
|
||||
// rules: {
|
||||
// 'react/react-in-jsx-scope': 'off', // react is a global in this folder
|
||||
// 'import/no-default-export': 'off', // pages have to have a default export
|
||||
// 'import/prefer-default-export': 'off',
|
||||
// '@typescript-eslint/explicit-module-boundary-types': [
|
||||
// // So we can infer prop types
|
||||
// 'warn',
|
||||
// { allowedNames: ['getStaticProps'] },
|
||||
// ],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// files: ['**/*.stories.*'],
|
||||
// rules: {
|
||||
// // Storybook requires default exports for stories
|
||||
// 'import/no-default-export': 'off',
|
||||
// '@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// parser: '@typescript-eslint/parser',
|
||||
// }
|
||||
// ]
|
||||
22
package.json
22
package.json
@@ -34,7 +34,7 @@
|
||||
"clean:autogen": "find -type d -name autogen -exec rm -rfv '{}' \\; || true",
|
||||
"clean:full": "yarn clean:libndist && yarn clean:autogen",
|
||||
"format": "prettier --write \"{*,**/*}.{ts,tsx,js,jsx,json,yml,yaml,md}\"",
|
||||
"lint": "eslint --ignore-path .gitignore \"./packages/**/*.{ts,tsx,js,jsx}\"",
|
||||
"lint": "NODE_OPTIONS='--max-old-space-size=4096' eslint",
|
||||
"typecheck": "lerna run typecheck",
|
||||
"prepare-disabled": "lerna run prepare && husky install",
|
||||
"precommit": "yarn generate && lerna run --concurrency 1 --stream precommit && yarn lint-staged",
|
||||
@@ -60,11 +60,14 @@
|
||||
"devDependencies": {
|
||||
"@apollo/rover": "^0.23.0",
|
||||
"@composedb/cli": "^0.7.1",
|
||||
"@eslint/compat": "^1.1.1",
|
||||
"@eslint/js": "^9.7.0",
|
||||
"@graphql-codegen/cli": "^5.0.2",
|
||||
"@graphql-codegen/client-preset": "^4.3.2",
|
||||
"@graphql-codegen/typescript-graphql-request": "^6.2.0",
|
||||
"@graphql-codegen/typescript-resolvers": "^4.2.1",
|
||||
"@graphql-codegen/typescript-urql": "^4.0.0",
|
||||
"@types/eslint__js": "^8.42.3",
|
||||
"@types/jest": "^29.2.1",
|
||||
"@types/node": "^20.8.6",
|
||||
"@types/react": "^18.0.21",
|
||||
@@ -74,26 +77,17 @@
|
||||
"@typescript-eslint/parser": "^7.16.1",
|
||||
"concurrently": "7.0.0",
|
||||
"env-cmd": "10.1.0",
|
||||
"eslint": "^8.39.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.5",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||
"eslint": "^9.7.0",
|
||||
"hasura-cli": "2.23.0",
|
||||
"husky": "7.0.4",
|
||||
"jest": "^29.2.2",
|
||||
"lerna": "^8.1.6",
|
||||
"lint-staged": "12.3.5",
|
||||
"lint-staged": "^15.2.7",
|
||||
"prettier": "2.7.1",
|
||||
"standard-version": "9.3.2",
|
||||
"ts-jest": "^29.0.3",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript": "^5.5.3",
|
||||
"typescript-eslint": "^7.16.1",
|
||||
"wait-on": "6.0.1"
|
||||
},
|
||||
"resolutions": {
|
||||
|
||||
@@ -2,7 +2,7 @@ import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const config = {
|
||||
export default {
|
||||
overwrite: true,
|
||||
require: ['ts-node/register'],
|
||||
generates: {
|
||||
@@ -98,6 +98,4 @@ const config = {
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"overrides": [
|
||||
export default {
|
||||
overrides: [
|
||||
{
|
||||
"files": ["./src/handlers/actions/types.ts"],
|
||||
"rules": {
|
||||
files: ["./src/handlers/actions/types.ts"],
|
||||
rules: {
|
||||
"@typescript-eslint/naming-convention": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["./src/handlers/**/*.ts"],
|
||||
"rules": {
|
||||
files: ["./src/handlers/**/*.ts"],
|
||||
rules: {
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"no-console": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["./src/**/*.ts"],
|
||||
"rules": {
|
||||
files: ["./src/**/*.ts"],
|
||||
rules: {
|
||||
"import/extensions": ["error", { "json": "always" }],
|
||||
"no-console": "off"
|
||||
}
|
||||
@@ -58,6 +58,7 @@
|
||||
"@types/create-hash": "^1.2.6",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^20.14.10",
|
||||
"@types/secp256k1": "^4.0.6",
|
||||
"@types/showdown": "^2.0.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"nock": "13.2.4",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"rules": {
|
||||
export default {
|
||||
rules: {
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": "warn"
|
||||
},
|
||||
"overrides": [
|
||||
overrides: [
|
||||
{
|
||||
"files": ["./src/**/*.{ts,tsx,js,jsx}", "./stories/**/*.{ts,tsx,js,jsx}"],
|
||||
"rules": {
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"overrides": [
|
||||
export default {
|
||||
overrides: [
|
||||
{
|
||||
"files": ["./src/**/*.ts", "./test/**/*.ts"],
|
||||
"rules": {
|
||||
files: ["./src/**/*.ts", "./test/**/*.ts"],
|
||||
rules: {
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"class-methods-use-this": "off",
|
||||
"no-console": "off"
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
rules: {
|
||||
'no-console': [
|
||||
'error',
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
extends: ['plugin:@next/next/recommended'],
|
||||
rules: {
|
||||
'no-console': [
|
||||
@@ -49,6 +49,7 @@
|
||||
"**/dist/",
|
||||
"**/*.mjs",
|
||||
"**/coverage/",
|
||||
"**/jest.config.js"
|
||||
"**/jest.config.js",
|
||||
"**/eslint.config.js"
|
||||
]
|
||||
}
|
||||
|
||||
11
tsconfig.eslint.json
Normal file
11
tsconfig.eslint.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
// extend your base config to share compilerOptions, etc
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
// ensure that nobody can accidentally use this config for a build
|
||||
"noEmit": true,
|
||||
},
|
||||
"exclude": [
|
||||
"./.prettierrc.cjs",
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user