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

Bump stylelint-prettier & prettier to latest non-breaking version possible #1612

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f067db1
Bump stylelint-prettier to 3.0.0
Adamik10 Dec 27, 2024
dd87d7d
Update Prettier to 3.0.0 and stylelint-prettier to 4.0.0
Adamik10 Dec 27, 2024
85c8cf2
Bump eslint-plugin-prettier to version 5.2.1
Adamik10 Dec 27, 2024
b7a7d6d
Refactor ESLint configuration to switch the order of Prettier and Cyp…
Adamik10 Dec 28, 2024
1a40807
Lint + fix the application
Adamik10 Dec 28, 2024
250679a
Update Prettier to latest v 3.4.2
Adamik10 Jan 3, 2025
428c427
Merge branch 'develop' into DDFBRA-301-opgrader-stylelint-prettier-re…
Adamik10 Jan 3, 2025
2160b36
Refactor ESLint configuration for improved readability and consistency
Adamik10 Jan 3, 2025
302214e
Run prettier in src/apps & src/components
Adamik10 Jan 3, 2025
e6a641f
Bump stylelint-prettier to latest v 5.0.2 and prettify src/core/utils
Adamik10 Jan 3, 2025
4d3ff73
Update stylelint to version 16.12.0
Adamik10 Jan 3, 2025
11a3718
Update eslint to version 9.17.0
Adamik10 Jan 3, 2025
78f5ad5
Rename ESLint configuration file to eslint.config.js and update scripts
Adamik10 Jan 3, 2025
8c134ed
Refactor ESLint configuration to match documentation
Adamik10 Jan 3, 2025
452cda4
Refactor ESLint configuration to use array format and improve rule or…
Adamik10 Jan 3, 2025
c51d0da
Refactor ESLint configuration to match documentation part 3
Adamik10 Jan 3, 2025
e12ca43
Update @typescript-eslint packages to version 8.19.0
Adamik10 Jan 3, 2025
0a0eb02
Update eslint.config.js to recommended format + add rules we followed…
Adamik10 Jan 3, 2025
860008e
Lint + fix all files based on latest recommendations
Adamik10 Jan 3, 2025
cf2ddf2
Add .prettierignore to exclude GitHub workflows from formatting
Adamik10 Jan 3, 2025
f0b7080
Don't use depricated --ext Eslint flags in pull_request.yml
Adamik10 Jan 3, 2025
cae23e3
Update eslint_flags in pull_request.yml to target only the src directory
Adamik10 Jan 3, 2025
1747e6e
Fix eslint errors
Adamik10 Jan 3, 2025
5b7566a
Export InputProps type in withIsPatronBlockedHoc.tsx
Adamik10 Jan 3, 2025
7448b5f
Remove unnecessary empty JSX fragments from various components
Adamik10 Jan 6, 2025
80e3917
Merge branch 'develop' into DDFBRA-301-opgrader-stylelint-prettier-re…
Adamik10 Jan 7, 2025
37c1d1f
Try to delete eslint parserOptions prop to see if it fixes lint:js er…
Adamik10 Jan 7, 2025
e8b33c1
Update ESLint configuration to exclude test files in subdirectories
Adamik10 Jan 7, 2025
2cd1cc6
Reinstate the @typescript-eslint/ban-ts-comment rule + fix issues
Adamik10 Jan 7, 2025
f34ca84
Prettify various files according to the latest lint:js:fix
Adamik10 Jan 7, 2025
84d8083
Explicitly include jsxA11yRecommended rules + fix errors.
Adamik10 Jan 7, 2025
48a3d75
Update ESLint configuration to include prettierRecommended rules and …
Adamik10 Jan 7, 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.

152 changes: 0 additions & 152 deletions .eslintrc

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Build and test
on: pull_request

jobs:

stylelint:
name: Lint .scss
if: '!github.event.deleted'
Expand Down Expand Up @@ -71,7 +70,7 @@ jobs:
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
eslint_flags: '--ext .js --ext .jsx ./src/'
eslint_flags: './src/'
- name: Lint Javascript
run: yarn lint:js

Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.github/workflows/
.version.json.ejs
216 changes: 216 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
const prettier = require("eslint-config-prettier");
const airbnbBase = require("eslint-config-airbnb");
const airbnbTypeScript = require("eslint-config-airbnb-typescript");
const airbnbHooks = require("eslint-config-airbnb/hooks");
const prettierRecommended = require("eslint-plugin-prettier").configs
.recommended;
const cypress = require("eslint-plugin-cypress").configs.recommended;
// Include the recommended settings for @typescript-eslint
const typescriptRecommended = {
plugins: {
"@typescript-eslint": require("@typescript-eslint/eslint-plugin")
},
rules: {
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/explicit-module-boundary-types": "off"
}
};
const jsxA11yRecommended = require("eslint-plugin-jsx-a11y").configs
.recommended;

// ESLint configuration using flat config
module.exports = [
{
files: ["**/*.{ts,tsx,js,jsx}"],
languageOptions: {
parser: require("@typescript-eslint/parser"),
parserOptions: {
project: "./tsconfig.json", // Specify the TypeScript project configuration
sourceType: "module",
ecmaFeatures: {
jsx: true // Enable JSX support
}
}
},
settings: {
react: {
version: "16.11.0" // React version for linting
},
// Since we use vitest alongside our production code, we have to instruct ESLint
// not to throw the import/no-extraneous-dependencies error when doing so.
"import/core-modules": ["vitest"]
},
plugins: {
"@typescript-eslint": require("@typescript-eslint/eslint-plugin"),
cypress: require("eslint-plugin-cypress"),
"react-hooks": require("eslint-plugin-react-hooks"),
react: require("eslint-plugin-react"),
import: require("eslint-plugin-import"),
"jsx-a11y": require("eslint-plugin-jsx-a11y"),
"no-only-tests": require("eslint-plugin-no-only-tests"),
prettier: require("eslint-plugin-prettier")
},
rules: {
// Extend rules from airbnb, prettier, cypress, and @typescript-eslint plugins
...airbnbBase.rules,
...airbnbTypeScript.rules,
...airbnbHooks.rules,
...prettier.rules,
...cypress.rules,
...typescriptRecommended.rules,
...jsxA11yRecommended.rules,
...prettierRecommended.rules,
// Custom rules
"@typescript-eslint/consistent-type-imports": "off",
"prefer-arrow-callback": [
"error",
{
allowNamedFunctions: false,
allowUnboundThis: true
}
],
"no-param-reassign": [
"error",
{
props: true,
ignorePropertyModificationsFor: ["state"] // Ignore state reassignment
}
],
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: [
"/**/*.dev.jsx",
"/**/*.dev.tsx",
"/**/*.test.js",
"/**/*.test.jsx",
"/**/*.test.ts",
"/**/*.test.tsx",
"vitest.config.ts",
"webpack.config.js",
"webpack.helpers.js",
"postcss.config.js",
"orval.config.ts",
"cypress/plugins/index.js",
"cypress/support/index.ts",
"scripts/postcss-node-sass.js",
"scripts/post-process-generated-graphql.ts",
"cypress/utils/graphql-test-utils.ts"
]
}
],
// Needed until new TypeScript versions are supported
"@typescript-eslint/no-empty-function": "off",
// We like to use arrow function syntax also for functional components.
"react/function-component-definition": "off",
// No complaints about missing trailing commas
"@typescript-eslint/comma-dangle": "off",
"react-hooks/exhaustive-deps": [
"warn",
{
additionalHooks: "useDeepCompareEffect"
}
],
"no-only-tests/no-only-tests": "warn", // Warn on `.only` in tests
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": true, // flag all `@ts-ignore` comments
"ts-expect-error": true, // flag all `@ts-expect-error` comments
"ts-nocheck": true, // flag all `@ts-nocheck` comments
"ts-check": true // flag all `@ts-check` comments
}
],
"prettier/prettier": [
"error",
{
// Needed to avoid conflicts with Prettier
"parser": "flow"
}
]
}
},
// JS/JSX-specific rules
{
files: ["*.js", "*.jsx"],
rules: {
// These rules were triggered on the former non-TypeScript codebase.
// We are planning to use only ts/tsx in the future.
// Therefore, we can separate them by only being ignored on js/jsx files.
// Start - ddb-react former code
"react/jsx-no-bind": "off",
"react/function-component-definition": "off",
"react/forbid-prop-types": "off",
"react/destructuring-assignment": "off",
"@typescript-eslint/return-await": "off",
"no-param-reassign": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/no-implied-eval": "off",
"@typescript-eslint/no-throw-literal": "off"
// End - ddb-react former code
}
},
// TS/TSX-specific rules
{
files: ["*.tsx", "*.ts"],
rules: {
// We do not use prop-types in TypeScript.
"react/prop-types": "off",
"react/require-default-props": "off",
"react/no-unused-prop-types": "off",
"no-underscore-dangle": [
"error",
{
allow: ["__typename"] // Allow specific underscores
}
],
"react/forbid-elements": [
1,
{
forbid: [
{
element: "main",
message:
"dpl-cms provides a <main> to render React in, therefore you must use <section> to avoid duplicate <main>"
}
]
}
]
}
},
// Storybook development rules
{
files: ["*.dev.jsx", "*.dev.tsx"],
rules: {
// Allow spreading props in stories
"react/jsx-props-no-spreading": "off"
}
},
// Entry point rules
{
files: ["*.entry.tsx"],
rules: {
// Disable unused vars rule for entry points
"@typescript-eslint/no-unused-vars": "off"
}
},
// Ignore specific files
{
ignores: [
"src/core/cover-service-api/model/*",
"src/core/cover-service-api/cover-service.ts",
"src/core/dpl-cms/model/*",
"src/core/dpl-cms/dpl-cms.ts",
"src/core/fbs/fbs.ts",
"src/core/publizon/publizon.ts",
"src/**/*.test.ts",
"src/**/*.test.tsx",
"eslint.config.js"
]
}
];
Loading
Loading