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

ESLint: update peers in advance of v9 upgrade #47

Merged
merged 1 commit into from
Nov 7, 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
31 changes: 15 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,33 @@
"_prettier": "prettier \"**/*.{js,cjs,ts,json,yaml,md}\"",
"_eslint": "eslint \".*.cjs\" \"**/*.{js,cjs,ts}\""
},
"packageManager": "pnpm@9.4.0+sha256.b6fd0bfda555e7e584ad7e56b30c68b01d5a04f9ee93989f4b93ca8473c49c74",
"packageManager": "pnpm@9.12.3+sha256.24235772cc4ac82a62627cd47f834c72667a2ce87799a846ec4e8e555e2d4b8b",
"dependencies": {
"@viamrobotics/eslint-config": "workspace:*",
"@viamrobotics/prettier-config": "workspace:*",
"@viamrobotics/typescript-config": "workspace:*"
},
"devDependencies": {
"@types/node": "^20.14.10",
"@types/node": "^22.9.0",
"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"concurrently": "^8.2.2",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"concurrently": "^9.1.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest-dom": "^5.4.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonarjs": "^1.0.3",
"eslint-plugin-svelte": "^2.41.0",
"eslint-plugin-tailwindcss": "^3.17.4",
"eslint-plugin-testing-library": "^6.2.2",
"eslint-plugin-unicorn": "^54.0.0",
"eslint-plugin-svelte": "^2.46.0",
"eslint-plugin-tailwindcss": "^3.17.5",
"eslint-plugin-testing-library": "^6.4.0",
"eslint-plugin-unicorn": "^56.0.0",
"eslint-plugin-vitest": "^0.5.4",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.6.5",
"semver": "^7.6.2",
"typescript": "^5.5.3",
"vitest": "^2.0.1"
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.7",
"prettier-plugin-tailwindcss": "^0.6.8",
"semver": "^7.6.3",
"typescript": "^5.6.3",
"vitest": "^2.1.4"
},
"pnpm": {
"peerDependencyRules": {
Expand Down
2 changes: 0 additions & 2 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pnpm add --save-dev \
@typescript-eslint/eslint-plugin \
eslint \
eslint-config-prettier \
eslint-plugin-sonarjs \
eslint-plugin-unicorn \
eslint-plugin-vitest
```
Expand Down Expand Up @@ -46,7 +45,6 @@ pnpm add --save-dev \
eslint \
eslint-config-prettier \
eslint-plugin-jest-dom \
eslint-plugin-sonarjs \
eslint-plugin-svelte \
eslint-plugin-tailwindcss \
eslint-plugin-testing-library \
Expand Down
39 changes: 18 additions & 21 deletions packages/eslint-config/base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = {
'plugin:@typescript-eslint/strict-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:unicorn/recommended',
'plugin:sonarjs/recommended-legacy',
'prettier',
],
parserOptions: {
Expand Down Expand Up @@ -105,7 +104,7 @@ module.exports = {
'no-template-curly-in-string': 'error',
'no-unneeded-ternary': 'error',
'no-unreachable-loop': 'error',
'no-underscore-dangle': ['error', { allow: ['__VERSION__'] }],
'no-underscore-dangle': ['error', { allow: ['__VERSION__', '_errors'] }],
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
'no-unused-private-class-members': 'error',
Expand All @@ -122,13 +121,6 @@ module.exports = {
'padding-line-between-statements': 'error',
'prefer-arrow-callback': 'error',
'prefer-const': 'error',
'prefer-destructuring': [
'error',
{
AssignmentExpression: { object: false, array: false },
VariableDeclarator: { object: true, array: true },
},
],
'prefer-exponentiation-operator': 'error',
'prefer-named-capture-group': 'error',
'prefer-numeric-literals': 'error',
Expand All @@ -154,6 +146,7 @@ module.exports = {
'error',
{ ignoreArrowShorthand: true },
],
'@typescript-eslint/no-import-type-side-effects': ['error'],
Copy link
Member Author

@mcous mcous Nov 7, 2024

Choose a reason for hiding this comment

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

Wanted to call this one out because it finally adds lint enforcement for:

// no
import { type Thing } from './place'
// yes
import type { Thing } from './place'

Which could be really helpful for circular dependency issues, depending on how rollup and/or esbuild do or don't strip imports

Copy link
Member

Choose a reason for hiding this comment

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

Yes! Nice, glad this is linted now

'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/no-unused-vars': [
'warn',
Expand All @@ -170,6 +163,17 @@ module.exports = {
},
],
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowAny: false,
allowBoolean: true,
allowNever: false,
allowNullish: false,
allowNumber: true,
allowRegExp: false,
},
],

// Import sorting
'simple-import-sort/imports': [
Expand All @@ -193,11 +197,7 @@ module.exports = {
],
'simple-import-sort/exports': 'error',

// Extra SonarJS rules
'sonarjs/cognitive-complexity': ['error', 20],

// Extra Unicorn rules
'unicorn/consistent-destructuring': 'off',
'unicorn/custom-error-definition': 'error',
'unicorn/no-null': 'off',
'unicorn/no-unused-properties': 'error',
Expand All @@ -217,24 +217,21 @@ module.exports = {
commonjs: true,
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
},
// __dirname and __filename are allowed in vite.config.ts
{
files: ['**/vite.config.ts', '**/vitest.config.ts'],
rules: {
'unicorn/prefer-module': 'off',
},
},
// Rules for tests
{
files: ['**/__tests__/**', '**/*.test.ts', '**/*.spec.ts'],
extends: ['plugin:vitest/legacy-recommended'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'sonarjs/no-duplicate-string': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'unicorn/consistent-function-scoping': 'off',
'vitest/consistent-test-filename': [
'error',
Expand Down
9 changes: 4 additions & 5 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"access": "public"
},
"version": "0.6.1",
"version": "0.7.0",
"description": "Common ESLint configuration for Viam projects.",
"files": [
"**/*",
Expand Down Expand Up @@ -41,17 +41,16 @@
],
"license": "Apache-2.0",
"peerDependencies": {
"@typescript-eslint/eslint-plugin": ">=6 <8",
"@typescript-eslint/parser": ">=6 <8",
"@typescript-eslint/eslint-plugin": ">=6 <9",
"@typescript-eslint/parser": ">=6 <9",
"eslint": ">=8 <9",
"eslint-config-prettier": ">=9 <10",
"eslint-plugin-jest-dom": ">=5 <6",
"eslint-plugin-simple-import-sort": ">=12 <13",
"eslint-plugin-sonarjs": ">=1 <2",
"eslint-plugin-svelte": ">=2 <3",
"eslint-plugin-tailwindcss": ">=3 <4",
"eslint-plugin-testing-library": ">=6 <7",
"eslint-plugin-unicorn": ">=47 <55",
"eslint-plugin-unicorn": ">=47 <57",
"eslint-plugin-vitest": ">=0.5 <0.6"
},
"peerDependenciesMeta": {
Expand Down
6 changes: 0 additions & 6 deletions packages/eslint-config/svelte.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ module.exports = {
parser: '@typescript-eslint/parser',
},
rules: {
/*
* TODO(mc, 2023-08-28): this rule is crashing with svelte actions.
* https://github.com/sveltejs/eslint-plugin-svelte/issues/583
*/
'sonarjs/no-unused-collection': 'off',

// Allows us to set option props to `undefined` by default
'no-undef-init': 'off',
},
Expand Down
Loading