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

TSOND 527 | update eslint configs #12

Merged
merged 4 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion config/contentstack/deliverySDk.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ContentstackLivePreview.init({
stackDetails: {
apiKey: process.env.CONTENTSTACK_API_KEY,
environment: process.env.CONTENTSTACK_ENVIRONMENT,
branch: process.env.CONTENTSTACK_BRANCH,
branch: process.env.CONTENTSTACK_BRANCH
},
stackSdk: Stack,
ssr: false
Expand Down
251 changes: 126 additions & 125 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,134 +1,135 @@
import react from "eslint-plugin-react";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
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);
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'
import { fixupConfigRules } from '@eslint/compat'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

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: ["src/utils/tracking.js"],
}, ...compat.extends(
"next/core-web-vitals",
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
), {
plugins: {
react,
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.browser,
},
})

const patchedConfig = fixupConfigRules([...compat.extends(
'next/core-web-vitals',
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended'
)])

const config = [
{
ignores: ['.next/*']
},
...patchedConfig,
{
languageOptions: {
globals: {
...globals.browser
},

parser: tsParser,
ecmaVersion: 13,
sourceType: "module",
parser: tsParser,
ecmaVersion: 13,
sourceType: 'module',

parserOptions: {
ecmaFeatures: {
jsx: true,
},
parserOptions: {
ecmaFeatures: {
jsx: true
}
}
},
},

settings: {
react: {
version: "detect",
settings: {
react: {
version: 'detect'
}
},
},

rules: {
"react-hooks/exhaustive-deps": "off",
indent: ["error", 4],
"linebreak-style": ["error", "unix"],
quotes: ["error", "single"],
semi: ["error", "never"],

"no-underscore-dangle": ["error", {
allow: ["_content_type_uid", "_source", "_esClient", "_version", "_metadata", "_"],
}],

"no-shadow": ["error", {
builtinGlobals: false,
hoist: "functions",
allow: [],
}],

"@typescript-eslint/no-explicit-any": "off",
"comma-dangle": ["error", "never"],

"max-len": ["error", {
code: 250,
}],

radix: "error",

"key-spacing": ["error", {
beforeColon: false,
}],

"dot-notation": "error",
"operator-linebreak": ["error", "before"],
"@typescript-eslint/no-empty-function": "off",
"space-before-function-paren": ["error", "always"],
"array-callback-return": "off",
"consistent-return": "off",
"class-methods-use-this": "off",
"no-restricted-syntax": "off",

"import/order": [1, {
groups: ["external", "builtin", "internal", "sibling", "parent", "index"],
}],

"sort-imports": ["error", {
ignoreCase: true,
ignoreDeclarationSort: true,
}],

"jsx-quotes": ["error", "prefer-single"],
"no-param-reassign": "off",
"react/no-children-prop": "off",
"no-nested-ternary": "off",

"react/jsx-key": ["off", {
checkFragmentShorthand: false,
}],

"no-plusplus": ["error", {
allowForLoopAfterthoughts: true,
}],

"react/forbid-prop-types": "off",
"react/require-default-props": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/anchor-has-content": "off",
"jsx-a11y/control-has-associated-label": "off",
"no-mixed-operators": "off",
"react/no-danger": "off",
"react/destructuring-assignment": 0,
"no-useless-escape": "off",

"no-console": ["error", {
allow: ["warn", "error", "debug"],
}],

"react/react-in-jsx-scope": "off",

"react/jsx-filename-extension": [1, {
extensions: [".js", ".tsx", ".ts"],
}],
},
}];

rules: {
'react-hooks/exhaustive-deps': 'off',
indent: ['error', 4],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'never'],

'no-underscore-dangle': ['error', {
allow: ['_content_type_uid', '_source', '_esClient', '_version', '_metadata', '_', '__dirname', '__filename']
}],

'no-shadow': ['error', {
builtinGlobals: false,
hoist: 'functions',
allow: []
}],

'@typescript-eslint/no-explicit-any': 'off',
'comma-dangle': ['error', 'never'],

'max-len': ['error', {
code: 250
}],

radix: 'error',

'key-spacing': ['error', {
beforeColon: false
}],

'dot-notation': 'error',
'operator-linebreak': ['error', 'before'],
'@typescript-eslint/no-empty-function': 'off',
'space-before-function-paren': ['error', 'always'],
'array-callback-return': 'off',
'consistent-return': 'off',
'class-methods-use-this': 'off',
'no-restricted-syntax': 'off',

'import/order': [1, {
groups: ['external', 'builtin', 'internal', 'sibling', 'parent', 'index']
}],

'sort-imports': ['error', {
ignoreCase: true,
ignoreDeclarationSort: true
}],

'jsx-quotes': ['error', 'prefer-single'],
'no-param-reassign': 'off',
'react/no-children-prop': 'off',
'no-nested-ternary': 'off',

'react/jsx-key': ['off', {
checkFragmentShorthand: false
}],

'no-plusplus': ['error', {
allowForLoopAfterthoughts: true
}],

'react/forbid-prop-types': 'off',
'react/require-default-props': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/anchor-has-content': 'off',
'jsx-a11y/control-has-associated-label': 'off',
'no-mixed-operators': 'off',
'react/no-danger': 'off',
'react/destructuring-assignment': 0,
'no-useless-escape': 'off',

'no-console': ['error', {
allow: ['warn', 'error', 'debug']
}],

'react/react-in-jsx-scope': 'off',

'react/jsx-filename-extension': [1, {
extensions: ['.js', '.tsx', '.ts']
}]
}
}]

export default config
1 change: 0 additions & 1 deletion loaders/articleListing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import _ from 'lodash'
import { Taxonomy } from '@/types/pages'
import { getEntries, getEntryByUrl } from '@/services'
import { imageCardsReferenceIncludes, teaserReferenceIncludes, textAndImageReferenceIncludes, textJSONRtePaths } from './loaders.helper'
Expand Down
Loading
Loading