Skip to content

Commit

Permalink
Merge branch 'canary' into brody/fix-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb committed Mar 5, 2024
2 parents 72cc0f5 + 2ff7465 commit d362981
Show file tree
Hide file tree
Showing 15 changed files with 1,724 additions and 1,765 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -88,6 +88,7 @@ The following additional configs are available:
- `@vercel/style-guide/eslint/playwright-test`
- `@vercel/style-guide/eslint/react`
- `@vercel/style-guide/eslint/typescript` (requires `typescript` to be installed and [additional configuration](#configuring-eslint-for-typescript))
- `@vercel/style-guide/eslint/vitest`

> You'll need to use `require.resolve` to provide ESLint with absolute paths,
> due to an issue around ESLint config resolution (see
Expand Down
2 changes: 1 addition & 1 deletion eslint/browser.js
@@ -1,5 +1,5 @@
module.exports = {
extends: require.resolve('./_base'),
extends: './_base',
env: {
browser: true,
},
Expand Down
9 changes: 5 additions & 4 deletions eslint/playwright-test.js
@@ -1,6 +1,7 @@
module.exports = {
extends: [
'plugin:playwright/playwright-test',
require.resolve('./rules/playwright-test.js'),
],
plugins: ['playwright'],
extends: [require.resolve('./rules/playwright-test.js')],
env: {
'shared-node-browser': true,
},
};
6 changes: 0 additions & 6 deletions eslint/rules/best-practice.js
Expand Up @@ -162,12 +162,6 @@ module.exports = {
* 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign
*/
'no-return-assign': 'error',
/**
* Disallows unnecessary `return await`.
*
* 🚫 Not fixable - https://eslint.org/docs/rules/no-return-await
*/
'no-return-await': 'error',
/**
* Disallow use of `javascript:` urls.
*
Expand Down
6 changes: 0 additions & 6 deletions eslint/rules/jest.js
Expand Up @@ -12,11 +12,5 @@ module.exports = {
* 🔧 Fixable - https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-lowercase-title.md
*/
'jest/prefer-lowercase-title': 'warn',
/**
* Require test cases and hooks to be inside a `describe` block.
*
* 🚫 Not fixable - https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-top-level-describe.md
*/
'jest/require-top-level-describe': 'error',
},
};
15 changes: 8 additions & 7 deletions eslint/rules/playwright-test.js
@@ -1,9 +1,10 @@
// Source: https://github.com/playwright-community/eslint-plugin-playwright/blob/main/src/index.ts
// Source: https://github.com/playwright-community/eslint-plugin-playwright/blob/v1.5.1/src/index.ts#L101-L129
const recommended = {
'no-empty-pattern': 'off',
'playwright/expect-expect': 'warn',
'playwright/max-nested-describe': 'warn',
'playwright/missing-playwright-await': 'error',
'playwright/no-conditional-expect': 'warn',
'playwright/no-conditional-in-test': 'warn',
'playwright/no-element-handle': 'warn',
'playwright/no-eval': 'warn',
Expand All @@ -13,11 +14,17 @@ const recommended = {
'playwright/no-networkidle': 'error',
'playwright/no-page-pause': 'warn',
'playwright/no-skipped-test': 'warn',
'playwright/no-standalone-expect': 'error',
'playwright/no-unsafe-references': 'error',
'playwright/no-useless-await': 'warn',
'playwright/no-useless-not': 'warn',
'playwright/no-wait-for-selector': 'warn',
'playwright/no-wait-for-timeout': 'warn',
'playwright/prefer-web-first-assertions': 'error',
'playwright/valid-describe-callback': 'error',
'playwright/valid-expect': 'error',
'playwright/valid-expect-in-promise': 'error',
'playwright/valid-title': 'error',
};

module.exports = {
Expand All @@ -35,11 +42,5 @@ module.exports = {
* 🔧 Fixable - https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
*/
'playwright/prefer-to-have-length': 'warn',
/**
* Require test cases and hooks to be inside a `test.describe` block.
*
* 🚫 Not fixable - https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
*/
'playwright/require-top-level-describe': 'error',
},
};
6 changes: 0 additions & 6 deletions eslint/rules/possible-errors.js
@@ -1,11 +1,5 @@
module.exports = {
rules: {
/**
* Disallow await inside of loops.
*
* 🚫 Not fixable - https://eslint.org/docs/rules/no-await-in-loop
*/
'no-await-in-loop': 'error',
/**
* Disallow the use of console.
*
Expand Down
6 changes: 0 additions & 6 deletions eslint/rules/react.js
Expand Up @@ -81,12 +81,6 @@ module.exports = {
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
*/
'react/jsx-pascal-case': 'warn',
/**
* Require props to be sorted alphabetically.
*
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
*/
'react/jsx-sort-props': 'warn',
/**
* Disallow usage of Array index in keys.
*
Expand Down
9 changes: 8 additions & 1 deletion eslint/rules/typescript/index.js
Expand Up @@ -14,7 +14,14 @@ module.exports = {
*
* 🔧 Fixable - https://typescript-eslint.io/rules/consistent-type-imports/
*/
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/consistent-type-imports': [
'warn',
{
disallowTypeAnnotations: true,
fixStyle: 'inline-type-imports',
prefer: 'type-imports',
},
],
/**
* Require explicit return types on functions and class methods.
*
Expand Down
12 changes: 0 additions & 12 deletions eslint/rules/typescript/strict.js

This file was deleted.

16 changes: 16 additions & 0 deletions eslint/rules/vitest.js
@@ -0,0 +1,16 @@
module.exports = {
rules: {
/**
* Disallow duplicate setup and teardown hooks.
*
* 🚫 Not fixable - https://github.com/veritem/eslint-plugin-vitest/blob/HEAD/docs/rules/no-duplicate-hooks.md
*/
'vitest/no-duplicate-hooks': 'error',
/**
* Require lowercase test names.
*
* 🔧 Fixable - https://github.com/veritem/eslint-plugin-vitest/blob/HEAD/docs/rules/prefer-lowercase-title.md
*/
'vitest/prefer-lowercase-title': 'warn',
},
};
4 changes: 0 additions & 4 deletions eslint/typescript.js
Expand Up @@ -8,18 +8,14 @@ module.exports = {
{
files: TYPESCRIPT_FILES,
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/strict',
'plugin:@typescript-eslint/strict-type-checked',
'plugin:@typescript-eslint/stylistic',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:import/typescript',
'prettier',
require.resolve('./rules/typescript'),
require.resolve('./rules/typescript/extension'),
require.resolve('./rules/typescript/import'),
require.resolve('./rules/typescript/strict'),
require.resolve('./rules/tsdoc'),
],
},
Expand Down
3 changes: 3 additions & 0 deletions eslint/vitest.js
@@ -0,0 +1,3 @@
module.exports = {
extends: ['plugin:vitest/recommended', require.resolve('./rules/vitest')],
};
53 changes: 27 additions & 26 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "@vercel/style-guide",
"version": "5.3.0-canary.1",
"version": "5.3.0-canary.7",
"description": "Vercel's engineering style guide",
"homepage": "https://github.com/vercel/style-guide#readme",
"bugs": {
Expand Down Expand Up @@ -37,36 +37,37 @@
},
"prettier": "./prettier",
"dependencies": {
"@babel/core": "^7.22.11",
"@babel/eslint-parser": "^7.22.11",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"eslint-config-prettier": "^9.0.0",
"@babel/core": "^7.24.0",
"@babel/eslint-parser": "^7.23.10",
"@rushstack/eslint-patch": "^1.7.2",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-playwright": "^0.16.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-playwright": "^1.5.2",
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^6.0.1",
"eslint-plugin-testing-library": "^6.2.0",
"eslint-plugin-tsdoc": "^0.2.17",
"eslint-plugin-unicorn": "^48.0.1",
"prettier-plugin-packagejson": "^2.4.5"
"eslint-plugin-unicorn": "^51.0.1",
"eslint-plugin-vitest": "^0.3.22",
"prettier-plugin-packagejson": "^2.4.12"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
"@semantic-release/git": "^10.0.1",
"eslint": "^8.48.0",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"prettier": "^3.0.2",
"semantic-release": "^21.1.1",
"typescript": "^5.2.2"
"eslint": "^8.57.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"semantic-release": "^23.0.2",
"typescript": "^5.3.3"
},
"peerDependencies": {
"@next/eslint-plugin-next": ">=12.3.0 <15.0.0-0",
Expand All @@ -88,9 +89,9 @@
"optional": true
}
},
"packageManager": "pnpm@8.7.0",
"packageManager": "pnpm@8.15.4",
"engines": {
"node": ">=16"
"node": ">=18.18"
},
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit d362981

Please sign in to comment.