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

Adding prettier for code formatting, disabling ESLint formatting rules. #18325

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion .github/workflows/fix-linter-hints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
continue-on-error: true
working-directory: graylog2-web-interface
run: yarn lint --fix -o /tmp/report.json -f json
- name: Runt prettier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a type in Run

working-directory: graylog2-web-interface
run: yarn format
- name: Run lint:styles --fix
continue-on-error: true
working-directory: graylog2-web-interface
Expand All @@ -54,7 +57,7 @@ jobs:
author: Dr. Lint-a-lot <[email protected]>
branch: fix/linter-hints
committer: Dr. Lint-a-lot <[email protected]>
commit-message: Running lint --fix
commit-message: Running lint --fix & prettier
delete-branch: true

- name: Get headRef and SHA of PR
Expand Down
1 change: 1 addition & 0 deletions graylog2-web-interface/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@graylog/prettier-config"
5 changes: 4 additions & 1 deletion graylog2-web-interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"lint:changes": "./dev/lintChanges.sh",
"test": "jest --maxWorkers=50%",
"test:integration": "jest --maxWorkers=50% --config jest.it.config.js",
"check-production-build": "node checkProductionBuild.js"
"check-production-build": "node checkProductionBuild.js",
"format": "prettier --write src"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion it also makes sense to apply the formatting for the test and maybe even the docs directory.

},
"eslintConfig": {
"extends": "graylog"
Expand Down Expand Up @@ -116,6 +117,7 @@
"devDependencies": {
"@cfaester/enzyme-adapter-react-18": "0.7.1",
"@cyclonedx/webpack-plugin": "^3.9.1",
"@graylog/prettier-config": "^1.0.2",
"@types/chroma-js": "^2.1.3",
"@types/crossfilter": "0.0.38",
"@types/enzyme-adapter-react-16": "^1.0.6",
Expand Down Expand Up @@ -162,6 +164,7 @@
"less": "^4.1.2",
"less-loader": "^12.0.0",
"node-fetch": "^2.6.1",
"prettier": "^3.3.3",
"puppeteer": "^23.0.2",
"react-bootstrap": "0.33.1",
"style-loader": "3.3.4",
Expand Down
12 changes: 3 additions & 9 deletions graylog2-web-interface/packages/eslint-config-graylog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ module.exports = {
'plugin:import/react',
'plugin:jest-formatting/strict',
'plugin:graylog/recommended',
'prettier',
],
plugins: [
'import',
Expand All @@ -89,7 +90,6 @@ module.exports = {
rules: {
'arrow-body-style': ['error', 'as-needed'],
camelcase: 'off',
'function-paren-newline': 'off',
'import/extensions': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'off',
Expand Down Expand Up @@ -121,18 +121,12 @@ module.exports = {
}],
}],
'no-underscore-dangle': 'off',
'object-curly-newline': ['error', { multiline: true, consistent: true }],
'object-shorthand': ['error', 'methods'],
'react/destructuring-assignment': 'off',
'react/forbid-prop-types': 'off',
'react/function-component-definition': 'off',
'react/jsx-closing-bracket-location': ['warn', 'after-props'],
'react/jsx-curly-spacing': ['warn', { when: 'never', children: true }],
'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.tsx'] }],
'react/jsx-first-prop-new-line': ['warn', 'never'],
'react/jsx-indent-props': ['error', 'first'],
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'react/jsx-one-expression-per-line': 'off',
'react/jsx-props-no-spreading': 'off',
'react/prefer-es6-class': 'off',
'react/prefer-stateless-function': 'warn',
Expand Down Expand Up @@ -162,13 +156,13 @@ module.exports = {
},
{
blankLine: 'always',
prev: ['block', 'multiline-block-like', 'cjs-export', 'class', 'multiline-expression'],
prev: ['block', 'cjs-export', 'class'],
next: '*',
},
{
blankLine: 'always',
prev: '*',
next: ['block', 'multiline-block-like', 'class', 'multiline-expression', 'return'],
next: ['block', 'class', 'return'],
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@typescript-eslint/parser": "8.12.2",
"eslint": "8.57.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-webpack": "0.13.9",
"eslint-plugin-compat": "4.2.0",
"eslint-plugin-graylog": "file:../eslint-plugin-graylog",
Expand Down
Loading