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

Node: Fix linter config. #2272

Merged
merged 3 commits into from
Sep 11, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
* Python: Add Script commands ([#2208](https://github.com/valkey-io/valkey-glide/pull/2208))

#### Breaking Changes
* Node: (Refactor) Convert types to interfaces ([#2263](https://github.com/valkey-io/valkey-glide/pull/2263))
* Node: (Refactor) Convert classes to types ([#2005](https://github.com/valkey-io/valkey-glide/pull/2005))
* Core: Change FUNCTION STATS command to return multi node response for standalone mode ([#2117](https://github.com/valkey-io/valkey-glide/pull/2117))

Expand Down
92 changes: 52 additions & 40 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,48 +1,60 @@
// @ts-check
import eslint from '@eslint/js';
import prettierConfig from 'eslint-config-prettier';
import tseslint from 'typescript-eslint';

import eslint from "@eslint/js";
import prettierConfig from "eslint-config-prettier";
import tseslint from "typescript-eslint";

export default tseslint.config(
eslint.configs.recommended,
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
{ files: ['**/*.js'],
...tseslint.configs.disableTypeChecked,
},
{
ignores: ["*/ProtobufMessage.*", "**/*.d.ts", "node_modules/**", "build-ts/**", "jest.config.js", ],
{ files: ["**/*.js"], ...tseslint.configs.disableTypeChecked },
{
ignores: [
"*/ProtobufMessage.*",
"**/*.d.ts",
"node_modules/**",
"build-ts/**",
"jest.config.js",
"docs/**"
],
},
{rules: {
"import/no-unresolved": "off",
"padding-line-between-statements": ["error", {
blankLine: "always",
prev: "*",
next: "class",
}, {
blankLine: "always",
prev: "class",
next: "*",
}, {
blankLine: "always",
prev: "*",
next: "function",
}, {
blankLine: "always",
prev: "function",
next: "*",
}, {
blankLine: "always",
prev: "*",
next: "multiline-block-like",
}, {
blankLine: "always",
prev: "multiline-block-like",
next: "*",
}],
},
{
rules: {
"import/no-unresolved": "off",
"padding-line-between-statements": [
"error",
{
blankLine: "always",
prev: "*",
next: "class",
},
{
blankLine: "always",
prev: "class",
next: "*",
},
{
blankLine: "always",
prev: "*",
next: "function",
},
{
blankLine: "always",
prev: "function",
next: "*",
},
{
blankLine: "always",
prev: "*",
next: "multiline-block-like",
},
{
blankLine: "always",
prev: "multiline-block-like",
next: "*",
},
],
},
prettierConfig,

},
prettierConfig,
);
2 changes: 2 additions & 0 deletions node/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ rust-client/*
# unignore specific files
!rust-client/package.json
!rust-client/tsconfig.json
# ignore docs dir
docs/*
10 changes: 1 addition & 9 deletions node/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,10 @@ Development on the Node wrapper may involve changes in either the TypeScript or
1. TypeScript

```bash
# Run from the root folder of the GLIDE repository
npm install --save-dev prettier
cd node
npx prettier --check .
# Run from the node folder
npm run lint
# To automatically apply ESLint and/or prettier recommendations
npx run lint:fix
npx prettier -w .
```

```bash

```

2. Rust
Expand Down
13 changes: 7 additions & 6 deletions node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"fix-protobuf-file": "replace 'this\\.encode\\(message, writer\\)\\.ldelim' 'this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim' src/ProtobufMessage.js",
"test": "npm run build-test-utils && jest --verbose --runInBand --testPathIgnorePatterns='RedisModules'",
"build-test-utils": "cd ../utils && npm i && npm run build",
"lint:fix": "npm run install-linting && npx eslint -c ../eslint.config.mjs --fix",
"lint": "npm run install-linting && npx eslint -c ../eslint.config.mjs",
"lint:fix": "npm run install-linting && npx eslint -c ../eslint.config.mjs --fix && npm run prettier:format",
"lint": "npm run install-linting && npx eslint -c ../eslint.config.mjs && npm run prettier:check:ci",
"install-linting": "cd ../ & npm install",
"prepack": "npmignore --auto",
"prettier:check:ci": "./node_modules/.bin/prettier --check . --ignore-unknown '!**/*.{js,d.ts}'",
"prettier:format": "./node_modules/.bin/prettier --write . --ignore-unknown '!**/*.{js,d.ts}'"
"prettier:check:ci": "npx prettier --check . --ignore-unknown '!**/*.{js,d.ts}'",
"prettier:format": "npx prettier --write . --ignore-unknown '!**/*.{js,d.ts}'"
},
"devDependencies": {
"@babel/preset-env": "^7.25.4",
Expand All @@ -63,7 +63,7 @@
"typescript": "^5.5.4",
"uuid": "^10.0.0"
},
"author": "Amazon Web Services",
"author": "Valkey contributors",
"license": "Apache-2.0",
"publishConfig": {
"${registry_scope}registry": "https://registry.npmjs.org/",
Expand All @@ -74,7 +74,8 @@
"!build-ts/**",
"babel.config.js",
"jest.config.js",
"hybrid-node-tests/**"
"hybrid-node-tests/**",
"docs/"
]
},
"//": [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"@types/eslint-config-prettier": "^6.11.3",
"eslint": "^9.10.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.3",
"typescript": "^5.6.2",
"typescript-eslint": "^8.5.0"
}
Expand Down
Loading