Skip to content

modernize #764

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
137 changes: 0 additions & 137 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.5.1]
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
## feathers-hooks-common

#### hooks

- added alterData, alterResult, deprecated alterItems
- added discardData, discardResult, deprecated discard
- moved to omitData, omitResult, deprecated omit
- added keepData, keepResult, deprecated keep
- moved to pickData, pickResult, deprecated pick
- added lowercaseData, lowercaseResult, deprecated lowercase
- added setNowData, setNowResult, deprecated setNow

- removed several checks that are handled by typescript
- removed check for `preventChanges(true, ...fieldNames)`

- renamed 'keepQuery' to 'pickQuery', added alias
- renamed 'required' to 'checkRequired', added alias

- added throwIf
- added throwIfIsProvider
- added throwIfIsMulti
- added paramsForServer2 & paramsForClient2

- added 'onDelete' & 'createRelated'

- stashBefore multi

- softDelete: added 'transformParams' & added 'key' option

- rm support for spread argument

#### predicates

- renamed 'isNot' to 'not' (added alias for 'isNot')
- added predicate isMulti
- added predicate isPaginated
- added predicate isContext

#### utils

- added getDataIsArray, getResultIsArray, deprecated getItems
- added replaceData, replaceResult, deprecated replaceItems
- added util getPaginate
- added util skipResult

### Hooks to discuss

- cache
- populate
- dePopulate
- fgraphql
- fastJoin
- sequelizeConvert
- serialize

<p align="center">
<img src="https://hooks-common.feathersjs.com/feathers-hooks-common-logo.png" width="200">
</p>
Expand Down
80 changes: 40 additions & 40 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
import { defineConfig } from "vitepress";
import { name, description, ogUrl, ogImage } from "./meta";
import { version } from '../../package.json'
import { defineConfig } from 'vitepress';
import { name, description, ogUrl, ogImage } from './meta';
import { version } from '../../package.json';

export default defineConfig({
title: "feathers-hooks-common",
title: 'feathers-hooks-common',
lastUpdated: true,
description: "",
description: '',
head: [
["meta", { name: "theme-color", content: "#ae0bb1" }],
["link", { rel: "icon", href: "/feathers-hooks-common-logo.png" }],
["meta", { property: "og:title", content: name }],
["meta", { property: "og:description", content: description }],
["meta", { property: "og:url", content: ogUrl }],
["meta", { property: "og:image", content: ogImage }],
["meta", { name: "twitter:title", content: name }],
["meta", { name: "twitter:description", content: description }],
["meta", { name: "twitter:image", content: ogImage }],
["meta", { name: "twitter:card", content: "summary_large_image" }],
['meta', { name: 'theme-color', content: '#ae0bb1' }],
['link', { rel: 'icon', href: '/feathers-hooks-common-logo.png' }],
['meta', { property: 'og:title', content: name }],
['meta', { property: 'og:description', content: description }],
['meta', { property: 'og:url', content: ogUrl }],
['meta', { property: 'og:image', content: ogImage }],
['meta', { name: 'twitter:title', content: name }],
['meta', { name: 'twitter:description', content: description }],
['meta', { name: 'twitter:image', content: ogImage }],
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
],
themeConfig: {
siteTitle: "feathers-hooks-common",
siteTitle: 'feathers-hooks-common',
editLink: {
pattern:
"https://github.com/feathersjs-ecosystem/feathers-hooks-common/edit/master/docs/:path",
'https://github.com/feathersjs-ecosystem/feathers-hooks-common/edit/master/docs/:path',
},
lastUpdatedText: "Last Updated",
lastUpdatedText: 'Last Updated',
socialLinks: [
{
icon: "twitter",
link: "https://twitter.com/feathersjs",
icon: 'twitter',
link: 'https://twitter.com/feathersjs',
},
{
icon: "discord",
link: "https://discord.gg/qa8kez8QBx",
icon: 'discord',
link: 'https://discord.gg/qa8kez8QBx',
},
{
icon: "github",
link: "https://github.com/feathersjs-ecosystem/feathers-hooks-common",
icon: 'github',
link: 'https://github.com/feathersjs-ecosystem/feathers-hooks-common',
},
],
logo: "/feathers-hooks-common-logo.png",
logo: '/feathers-hooks-common-logo.png',
sidebar: [
{
text: "Guide",
text: 'Guide',
items: [
{ text: "Overview", link: "/overview" },
{ text: "Hooks", link: "/hooks" },
{ text: "Utilities", link: "/utilities" },
{ text: "Migrating", link: "/migrating" },
{ text: "Guides", link: "/guides" },
{ text: 'Overview', link: '/overview' },
{ text: 'Hooks', link: '/hooks' },
{ text: 'Utilities', link: '/utilities' },
{ text: 'Migrating', link: '/migrating' },
{ text: 'Guides', link: '/guides' },
],
},
],
Expand All @@ -58,23 +58,23 @@ export default defineConfig({
items: [
{
text: 'Changelog',
link: 'https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/CHANGELOG.md'
link: 'https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/CHANGELOG.md',
},
{
text: 'Contributing',
link: 'https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/.github/contributing.md'
}
]
}
link: 'https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/.github/contributing.md',
},
],
},
],
footer: {
message: "Released under the MIT License.",
copyright: "Copyright © 2016-present Feathers contributors",
message: 'Released under the MIT License.',
copyright: 'Copyright © 2016-present Feathers contributors',
},
algolia: {
appId: '4GNLWKU0RF',
apiKey: '8114a3bec3c82b65c26a4ed113659bce',
indexName: 'feathers-hooks'
}
indexName: 'feathers-hooks',
},
},
});
8 changes: 4 additions & 4 deletions docs/.vitepress/meta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const name = "feathers-hooks-common";
export const description = "Common hooks and utils for FeathersJS apps";
export const name = 'feathers-hooks-common';
export const description = 'Common hooks and utils for FeathersJS apps';

export const ogUrl = "https://hooks-common.feathersjs.com/";
export const ogImage = "https://hooks-common.feathersjs.com/feathers-hooks-common-logo.png";
export const ogUrl = 'https://hooks-common.feathersjs.com/';
export const ogImage = 'https://hooks-common.feathersjs.com/feathers-hooks-common-logo.png';
6 changes: 3 additions & 3 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Theme from 'vitepress/theme'
import '../style/main.css'
import Theme from 'vitepress/theme';
import '../style/main.css';

export default {
...Theme,
}
};
52 changes: 52 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import eslintPluginImportX from 'eslint-plugin-import-x';
import tsParser from '@typescript-eslint/parser';

export default tseslint.config(
{
ignores: [
'**/node_modules',
'**/dist',
'**/coverage',
'docs/.vitepress/cache',
'docs/.vitepress/dist',
],
},
eslint.configs.recommended,
// eslint-disable-next-line import-x/no-named-as-default-member
tseslint.configs.recommended,
{
rules: {
// unset js rules
'no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
eslintPluginImportX.flatConfigs.recommended,
eslintPluginImportX.flatConfigs.typescript,
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
ignores: ['eslint.config.js'],
languageOptions: {
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
'import-x/no-dynamic-require': 'warn',
'import-x/no-nodejs-modules': 'error',
},
},
{
files: ['**/*.test.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'import-x/no-nodejs-modules': 'off',
},
},
eslintPluginPrettierRecommended,
);
Loading