Skip to content

Commit

Permalink
chore: format files after upgrading to Nx 17 (#2096)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt authored Feb 5, 2024
1 parent ac99a18 commit a587e00
Show file tree
Hide file tree
Showing 24 changed files with 89 additions and 97 deletions.
6 changes: 2 additions & 4 deletions .bundlemonrc.integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@
"maxPercentIncrease": 1
}
],
"reportOutput": [
"github"
]
}
"reportOutput": ["github"]
}
6 changes: 2 additions & 4 deletions .bundlemonrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,5 @@
"compression": "gzip"
}
],
"reportOutput": [
"github"
]
}
"reportOutput": ["github"]
}
6 changes: 2 additions & 4 deletions .bundlemonrc.plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,5 @@
"compression": "gzip"
}
],
"reportOutput": [
"github"
]
}
"reportOutput": ["github"]
}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ If you have ideas for creating unique libraries, you can join us. Email us at `n

#### Community

| Project | Package | Version | Links |
| ----------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Reset Plugin** | [`ngxs-reset-plugin`](https://npmjs.com/package/ngxs-reset-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-reset-plugin/latest.svg)](https://npmjs.com/package/ngxs-reset-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/ng-turkey/ngxs-reset-plugin/blob/master/README.md) |
| **NGXS-Loading-plugin** | [`ngxs-loading-plugin`](https://www.npmjs.com/package/ngxs-loading-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-loading-plugin/latest.svg)](https://www.npmjs.com/package/ngxs-loading-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/sa-bangash/ngxs-plugin/blob/master/README.md) |
| **NGXS-History-plugin** | [`ngxs-history-plugin`](https://www.npmjs.com/package/ngxs-history-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-history-plugin/latest.svg)](https://www.npmjs.com/package/ngxs-history-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/profanis/ngxs-history-plugin/blob/main/projects/ngxs-history-plugin/README.md) |
| Project | Package | Version | Links |
| ----------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Reset Plugin** | [`ngxs-reset-plugin`](https://npmjs.com/package/ngxs-reset-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-reset-plugin/latest.svg)](https://npmjs.com/package/ngxs-reset-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/ng-turkey/ngxs-reset-plugin/blob/master/README.md) |
| **NGXS-Loading-plugin** | [`ngxs-loading-plugin`](https://www.npmjs.com/package/ngxs-loading-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-loading-plugin/latest.svg)](https://www.npmjs.com/package/ngxs-loading-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/sa-bangash/ngxs-plugin/blob/master/README.md) |
| **NGXS-History-plugin** | [`ngxs-history-plugin`](https://www.npmjs.com/package/ngxs-history-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-history-plugin/latest.svg)](https://www.npmjs.com/package/ngxs-history-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/profanis/ngxs-history-plugin/blob/main/projects/ngxs-history-plugin/README.md) |

# Contributors

Expand Down
6 changes: 3 additions & 3 deletions docs/advanced/selector-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Let's start with a common example. Here we have a small state containing animals

```ts
import { Injectable } from '@angular/core';
import { Selector,State } from '@ngxs/store';
import { Selector, State } from '@ngxs/store';

export interface AnimalsStateModel {
zebras: string[];
Expand All @@ -30,8 +30,8 @@ export interface AnimalsStateModel {
defaults: {
zebras: [],
pandas: [],
monkeys: [],
},
monkeys: []
}
})
@Injectable()
export class AnimalsState {}
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { NgxsModule } from '@ngxs/store';
import { NgxsReduxDevtoolsPluginModule } from '@ngxs/devtools-plugin';

@NgModule({
imports: [NgxsModule.forRoot([]), NgxsReduxDevtoolsPluginModule.forRoot()],
imports: [NgxsModule.forRoot([]), NgxsReduxDevtoolsPluginModule.forRoot()]
})
export class AppModule {}
```
Expand Down
4 changes: 1 addition & 3 deletions docs/plugins/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ import { RouterDataResolved } from '@ngxs/router-plugin';
import { map } from 'rxjs/operators';

@Component({
template: `
<app-some-component [data]="data$ | async"></app-some-component>
`
template: ` <app-some-component [data]="data$ | async"></app-some-component> `
})
export class AppComponent {
data$ = this.actions$.pipe(
Expand Down
5 changes: 2 additions & 3 deletions docs/recipes/component-events-from-ngxs.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ export class LoadBooks {

export class BooksState {
static getBooks(genre: Genre) {
return createSelector(
[BooksState],
(books: Book[]) => books.filter(book => book.genre === genre)
return createSelector([BooksState], (books: Book[]) =>
books.filter(book => book.genre === genre)
);
}
}
Expand Down
51 changes: 29 additions & 22 deletions docs/recipes/module-federation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,36 @@ For this purpose, the dependencies are specified in the shared object in `webpac
```js
plugins: [
new ModuleFederationPlugin({

name: "mfOne",
filename: "remoteEntry.js",
exposes: {
'./mfModuleX': './apps/mfOne/src/app/x/x.module.ts',
'./mfModuleY': './apps/mfOne/src/app/y/y.module.ts',
new ModuleFederationPlugin({
name: 'mfOne',
filename: 'remoteEntry.js',
exposes: {
'./mfModuleX': './apps/mfOne/src/app/x/x.module.ts',
'./mfModuleY': './apps/mfOne/src/app/y/y.module.ts'
},

shared: share({
'@angular/core': { singleton: true, strictVersion: true, requiredVersion: 'auto' },
'@angular/common': { singleton: true, strictVersion: true, requiredVersion: 'auto' },
'@angular/common/http': {
singleton: true,
strictVersion: true,
requiredVersion: 'auto'
},

shared: share({
"@angular/core": {singleton: true, strictVersion: true, requiredVersion: 'auto'},
"@angular/common": {singleton: true, strictVersion: true, requiredVersion: 'auto'},
"@angular/common/http": {singleton: true, strictVersion: true, requiredVersion: 'auto'},
"@angular/router": {singleton: true, strictVersion: true, requiredVersion: 'auto'},
"@ngxs/devtools-plugin": {singleton: true, strictVersion: true, requiredVersion: '3.7.2'},
"@ngxs/store": {singleton: true, strictVersion: true, requiredVersion: '3.7.2'},
"rxjs": {singleton: true, strictVersion: true, requiredVersion: '6.6.7'},

...sharedMappings.getDescriptors()
})
}),
sharedMappings.getPlugin()
]
'@angular/router': { singleton: true, strictVersion: true, requiredVersion: 'auto' },
'@ngxs/devtools-plugin': {
singleton: true,
strictVersion: true,
requiredVersion: '3.7.2'
},
'@ngxs/store': { singleton: true, strictVersion: true, requiredVersion: '3.7.2' },
rxjs: { singleton: true, strictVersion: true, requiredVersion: '6.6.7' },

...sharedMappings.getDescriptors()
})
}),
sharedMappings.getPlugin()
];
```

## Into libraries
Expand Down
16 changes: 8 additions & 8 deletions packages/devtools-plugin/tests/devtools-custom.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ describe('[TEST]: Devtools with custom settings', () => {

@State({
name: 'count',
defaults: 0,
defaults: 0
})
@Injectable()
class CountState {
@Action({ type: 'increment' })
increment(ctx: StateContext<number>) {
ctx.setState((state) => state + 1);
ctx.setState(state => state + 1);
}
}

it('should disable devtools', () => {
TestBed.configureTestingModule({
imports: [
NgxsModule.forRoot([CountState]),
NgxsReduxDevtoolsPluginModule.forRoot({ disabled: true }),
],
NgxsReduxDevtoolsPluginModule.forRoot({ disabled: true })
]
});

store = TestBed.inject(Store);
Expand All @@ -41,8 +41,8 @@ describe('[TEST]: Devtools with custom settings', () => {
TestBed.configureTestingModule({
imports: [
NgxsModule.forRoot([CountState]),
NgxsReduxDevtoolsPluginModule.forRoot({ name: 'custom', maxAge: 1000 }),
],
NgxsReduxDevtoolsPluginModule.forRoot({ name: 'custom', maxAge: 1000 })
]
});

store = TestBed.inject(Store);
Expand All @@ -57,8 +57,8 @@ describe('[TEST]: Devtools with custom settings', () => {
TestBed.configureTestingModule({
imports: [
NgxsModule.forRoot([CountState]),
NgxsReduxDevtoolsPluginModule.forRoot({ trace: true, traceLimit: 10 }),
],
NgxsReduxDevtoolsPluginModule.forRoot({ trace: true, traceLimit: 10 })
]
});

store = TestBed.inject(Store);
Expand Down
2 changes: 1 addition & 1 deletion packages/store/internals/src/memoize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function memoize<T extends (...args: any[]) => any>(
lastArgs = arguments;
return lastResult;
}
(<any>memoized).reset = function() {
(<any>memoized).reset = function () {
// The hidden (for now) ability to reset the memoization
lastArgs = null;
lastResult = null;
Expand Down
6 changes: 3 additions & 3 deletions packages/store/operators/src/append.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export function append<T>(items: NoInfer<T[]>): StateOperator<T[]> {
// just return `existing`
const itemsNotProvidedButExistingIs = (!items || !items.length) && existing;
if (itemsNotProvidedButExistingIs) {
return (existing as unknown) as T[];
return existing as unknown as T[];
}

if (Array.isArray(existing)) {
return existing.concat((items as unknown) as ExistingState<T[]>);
return existing.concat(items as unknown as ExistingState<T[]>);
}

// For example if some property is added dynamically
// and didn't exist before thus it's not `ArrayLike`
return (items as unknown) as T[];
return items as unknown as T[];
};
}
4 changes: 2 additions & 2 deletions packages/store/operators/src/insert-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function insertItem<T>(value: NoInfer<T>, beforePosition?: number): State

// Property may be dynamic and might not existed before
if (!Array.isArray(existing)) {
return [(value as unknown) as T];
return [value as unknown as T];
}

const clone = existing.slice();
Expand All @@ -29,7 +29,7 @@ export function insertItem<T>(value: NoInfer<T>, beforePosition?: number): State
index = beforePosition!;
}

clone.splice(index, 0, (value as unknown) as T);
clone.splice(index, 0, value as unknown as T);
return clone;
};
}
2 changes: 1 addition & 1 deletion packages/store/src/decorators/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createSelectObservable, createSelectorFn, PropertyType } from './symbol
* Decorator for selecting a slice of state from the store.
*/
export function Select<T>(rawSelector?: T, ...paths: string[]): PropertyDecorator {
return function(target, key): void {
return function (target, key): void {
const name: string = key.toString();
const selectorId = `__${name}__selector`;
const selector = createSelectorFn(name, rawSelector, paths);
Expand Down
4 changes: 2 additions & 2 deletions packages/store/src/decorators/selector/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export function Selector<T extends SelectorDef<any>>(selectors?: T[]): SelectorT
selectorName: key.toString(),
getSelectorOptions() {
return {};
},
}
});
const newDescriptor = {
configurable: true,
get() {
return memoizedFn;
},
}
};
// Add hidden property to descriptor
(<any>newDescriptor)['originalFn'] = originalFn;
Expand Down
8 changes: 4 additions & 4 deletions packages/store/src/decorators/selector/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { StateToken } from '../../state-token/state-token';
import { ExtractTokenType } from '../../state-token/symbols';

export type SelectorSpec<T, U> = [T] extends [never]
? ((...states: any[]) => any)
: (T extends StateToken<any>
? (state: ExtractTokenType<T>) => U
: (...states: any[]) => any);
? (...states: any[]) => any
: T extends StateToken<any>
? (state: ExtractTokenType<T>) => U
: (...states: any[]) => any;

export type SelectorType<T> = <U>(
target: any,
Expand Down
2 changes: 1 addition & 1 deletion packages/store/src/operators/of-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function ofActionOperator(
): OperatorFunction<ActionContext, any> {
const allowedMap = createAllowedActionTypesMap(allowedTypes);
const allowedStatusMap = statuses && createAllowedStatusesMap(statuses);
return function(o: Observable<ActionContext>) {
return function (o: Observable<ActionContext>) {
return o.pipe(filterStatus(allowedMap, allowedStatusMap), mapOperator());
};
}
Expand Down
6 changes: 3 additions & 3 deletions packages/store/src/selectors/selector-metadata.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
ensureSelectorMetadata,
SelectorMetaDataModel,
SharedSelectorOptions,
SharedSelectorOptions
} from '../internal/internals';
import { CreationMetadata } from './selector-models';

Expand All @@ -14,7 +14,7 @@ export const selectorOptionsMetaAccessor = {
defineOptions: (target: any, options: SharedSelectorOptions) => {
if (!target) return;
(<any>target)[SELECTOR_OPTIONS_META_KEY] = options;
},
}
};

export function setupSelectorMetadata<T extends (...args: any[]) => any>(
Expand Down Expand Up @@ -44,6 +44,6 @@ function getLocalSelectorOptions(
...(selectorOptionsMetaAccessor.getOptions(selectorMetaData.containerClass) || {}),
...(selectorOptionsMetaAccessor.getOptions(selectorMetaData.originalFn) || {}),
...(selectorMetaData.getSelectorOptions() || {}),
...explicitOptions,
...explicitOptions
};
}
8 changes: 4 additions & 4 deletions packages/store/src/selectors/selector-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SelectorMetaDataModel,
SharedSelectorOptions,
RuntimeSelectorContext,
SelectorFactory,
SelectorFactory
} from '../internal/internals';
import { CreationMetadata, RuntimeSelectorInfo } from './selector-models';

Expand All @@ -24,7 +24,7 @@ export function createRootSelectorFactory<T extends (...args: any[]) => any>(

return function selectFromRoot(rootState: any) {
// Determine arguments from the app state using the selectors
const results = argumentSelectorFunctions.map((argFn) => argFn(rootState));
const results = argumentSelectorFunctions.map(argFn => argFn(rootState));

// if the lambda tries to access a something on the
// state that doesn't exist, it will throw a TypeError.
Expand Down Expand Up @@ -73,13 +73,13 @@ function getRuntimeSelectorInfo(
selectorMetaData.containerClass
);

const argumentSelectorFunctions = selectorsToApply.map((selector) => {
const argumentSelectorFunctions = selectorsToApply.map(selector => {
const factory = getRootSelectorFactory(selector);
return factory(context);
});
return {
selectorOptions,
argumentSelectorFunctions,
argumentSelectorFunctions
};
}

Expand Down
10 changes: 6 additions & 4 deletions packages/store/src/utils/compose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export type StateFn = (...args: any[]) => any;
*
* @ignore
*/
export const compose = (funcs: StateFn[]) => (...args: any[]) => {
const curr = funcs.shift()!;
return curr(...args, (...nextArgs: any[]) => compose(funcs)(...nextArgs));
};
export const compose =
(funcs: StateFn[]) =>
(...args: any[]) => {
const curr = funcs.shift()!;
return curr(...args, (...nextArgs: any[]) => compose(funcs)(...nextArgs));
};
2 changes: 1 addition & 1 deletion packages/store/src/utils/freeze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const deepFreeze = (o: any) => {
const oIsFunction = typeof o === 'function';
const hasOwnProp = Object.prototype.hasOwnProperty;

Object.getOwnPropertyNames(o).forEach(function(prop) {
Object.getOwnPropertyNames(o).forEach(function (prop) {
if (
hasOwnProp.call(o, prop) &&
(oIsFunction ? prop !== 'caller' && prop !== 'callee' && prop !== 'arguments' : true) &&
Expand Down
2 changes: 1 addition & 1 deletion packages/store/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function getActionTypeFromInstance(action: any): string | undefined {
export function actionMatcher(action1: any) {
const type1 = getActionTypeFromInstance(action1);

return function(action2: any) {
return function (action2: any) {
return type1 === getActionTypeFromInstance(action2);
};
}
Expand Down
Loading

0 comments on commit a587e00

Please sign in to comment.