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

feat(eslint-config): dropping use of eslint-plugin-prettier #832

Merged
merged 6 commits into from
Apr 2, 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
93 changes: 12 additions & 81 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"husky": "^9.0.11",
"lerna": "^8.1.2"
"lerna": "^8.1.2",
"prettier": "^3.2.5"
},
"commitlint": {
"extends": [
Expand Down
21 changes: 8 additions & 13 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const prettierConfig = require('./prettier.config');

/** @type {import("eslint-define-config").ESLintConfig} */
const config = {
extends: [
Expand All @@ -9,10 +7,12 @@ const config = {
'plugin:import/errors',
'plugin:import/warnings',
'plugin:you-dont-need-lodash-underscore/compatible',
'plugin:prettier/recommended', // This has to be the last rule added.
'prettier',
],
plugins: ['node', 'unicorn'],
rules: {
'arrow-body-style': 'off', // This rule clashes with our Prettier config.

'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
'eslint-comments/no-unused-disable': 'error',

Expand Down Expand Up @@ -45,23 +45,17 @@ const config = {

'no-restricted-imports': ['error', { paths: ['lodash'] }],

// Disallow shadowing of any variable that isn't "err" as this is a common case that is acceptable.
// Disallow shadowing of any variable that isn't "err" as this is a common case that is
// acceptable.
'no-shadow': ['error', { allow: ['err'] }],

'node/no-deprecated-api': 'error',
'node/no-exports-assign': 'error',
'node/no-extraneous-require': 'error',

'prefer-arrow-callback': 'off', // This rule clashes with our Prettier config.
'prefer-destructuring': 'off',

'prettier/prettier': [
'error',
prettierConfig,
{
usePrettierrc: false,
},
],

// The `eslint-config-airbnb-base` that we extend off of doesn't have any rules for catching for
// templated strings that aren't templates.
quotes: ['error', 'single', { avoidEscape: true }],
Expand All @@ -86,7 +80,8 @@ const config = {
'unicorn/prefer-type-error': 'error',
'unicorn/throw-new-error': 'error',

// We're comfortable using throttle and debounce out of Lodash instead of polyfilling them with something else.
// We're comfortable using throttle and debounce out of Lodash instead of polyfilling them with
// something else.
'you-dont-need-lodash-underscore/debounce': 'off',
'you-dont-need-lodash-underscore/throttle': 'off',
},
Expand Down
7 changes: 3 additions & 4 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.28.1",
Expand All @@ -33,7 +33,6 @@
"eslint-plugin-jest-formatting": "^3.0.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-readme": "file:../eslint-plugin",
Expand All @@ -43,14 +42,14 @@
"eslint-plugin-unicorn": "^51.0.1",
"eslint-plugin-vitest": "^0.4.1",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
"lodash.merge": "^4.6.2"
"lodash": "^4.17.21"
},
"peerDependencies": {
"eslint": "^8.0.0",
"prettier": "^3.0.0"
erunion marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"@types/lodash.merge": "^4.6.7",
"@types/lodash": "^4.17.0",
"eslint-define-config": "^2.0.0",
"typescript": "^5.4.3"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/testing/jest-dom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const merge = require('lodash.merge');
const merge = require('lodash/merge');

const jest = require('./jest');

Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/testing/jest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const merge = require('lodash.merge');
const merge = require('lodash/merge');

const common = require('./common.config');

Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/testing/vitest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const merge = require('lodash.merge');
const merge = require('lodash/merge');

const common = require('./common.config');

Expand Down