@ngrx/eslint-plugin 20.0.0-rc.0 → 20.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrx/eslint-plugin",
3
- "version": "20.0.0-rc.0",
3
+ "version": "20.0.1",
4
4
  "description": "NgRx ESLint Plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,7 +22,7 @@ export declare const selectExpression: (name: RegExp | string) => `:matches(Meth
22
22
  export declare const dispatchExpression: (name: RegExp | string) => `:matches(MethodDefinition[kind='constructor'] CallExpression[callee.object.name=${string}], CallExpression[callee.object.object.type='ThisExpression'][callee.object.property.name=${string}])[callee.property.name='dispatch']`;
23
23
  export declare const dispatchInEffects: (name: RegExp | string) => `CallExpression[callee.name='createEffect'] :matches(MethodDefinition[kind='constructor'] CallExpression[callee.object.name=${string}], CallExpression[callee.object.object.type='ThisExpression'][callee.object.property.name=${string}])[callee.property.name='dispatch'] > MemberExpression:has(Identifier[name=${string}])`;
24
24
  export declare const createReducer = "CallExpression[callee.name='createReducer']";
25
- export declare const onFunctionWithoutType: "CallExpression[callee.name='createReducer'] CallExpression[callee.name='on'] > ArrowFunctionExpression:not([returnType.typeAnnotation], :has(CallExpression))";
25
+ export declare const onFunctionWithoutType: "CallExpression[callee.name='createReducer'] CallExpression[callee.name='on'] > ArrowFunctionExpression:not([returnType.typeAnnotation])";
26
26
  export declare const storeActionReducerMap: "ClassDeclaration > Decorator > CallExpression[callee.name='NgModule'] ObjectExpression Property:matches([key.name=imports][computed=false], [key.value=imports], [key.quasis.0.value.raw=imports]) > ArrayExpression CallExpression[callee.object.name='StoreModule'][callee.property.name=/^for(Root|Feature)$/] > ObjectExpression:first-child";
27
27
  export declare const actionReducerMap = "VariableDeclarator[id.typeAnnotation.typeAnnotation.typeName.name='ActionReducerMap'] > ObjectExpression";
28
28
  export declare const mapLikeOperatorCallExpressions: ":matches(CallExpression[callee.name=/^(concat|merge|switch)MapTo$/], CallExpression[callee.name=/^(concat|exhaust|flat|merge|switch)Map$/] > :matches(ReturnStatement,ArrowFunctionExpression,FunctionExpression))";
@@ -34,7 +34,7 @@ exports.dispatchExpression = dispatchExpression;
34
34
  const dispatchInEffects = (name) => `${exports.createEffectExpression} ${(0, exports.dispatchExpression)(name)} > MemberExpression:has(Identifier[name=${name}])`;
35
35
  exports.dispatchInEffects = dispatchInEffects;
36
36
  exports.createReducer = `CallExpression[callee.name='createReducer']`;
37
- exports.onFunctionWithoutType = `${exports.createReducer} CallExpression[callee.name='on'] > ArrowFunctionExpression:not([returnType.typeAnnotation], :has(CallExpression))`;
37
+ exports.onFunctionWithoutType = `${exports.createReducer} CallExpression[callee.name='on'] > ArrowFunctionExpression:not([returnType.typeAnnotation])`;
38
38
  exports.storeActionReducerMap = `${exports.ngModuleImports} CallExpression[callee.object.name='StoreModule'][callee.property.name=/^for(Root|Feature)$/] > ObjectExpression:first-child`;
39
39
  exports.actionReducerMap = `VariableDeclarator[id.typeAnnotation.typeAnnotation.typeName.name='ActionReducerMap'] > ObjectExpression`;
40
40
  const mapLikeOperators = '/^(concat|exhaust|flat|merge|switch)Map$/';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/selectors/index.ts"],"names":[],"mappings":";;;AAqBA,4CAEC;AAvBY,QAAA,aAAa,GAAG,sDAAsD,CAAC;AACvE,QAAA,sBAAsB,GAAG,4CAA4C,CAAC;AAEtE,QAAA,eAAe,GAAG,4CAA4C,CAAC;AAC/D,QAAA,qCAAqC,GAChD,uDAAuD,uBAAe,EAAW,CAAC;AAEvE,QAAA,aAAa,GAAG,4CAA4C,CAAC;AAC7D,QAAA,wBAAwB,GACnC,GAAG,qBAAa,oDAA6D,CAAC;AACnE,QAAA,kBAAkB,GAC7B,GAAG,qBAAa,wCAAiD,CAAC;AACvD,QAAA,0BAA0B,GACrC,GA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AgB,oBACwC;AAE9D,MAAM,kBAAkB,GAAG,CAAC,IAAqB,EAAE,EAAE,CAC1D,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,mCAA4C,CAAC;AAD1D,QAAA,kBAAkB,sBACwC;AAEhE,MAAM,iBAAiB,GAAG,CAAC,IAAqB,EAAE,EAAE,CACzD,GAAG,8BAAsB,IAAI,IAAA,0BAAkB,EAC7C,IAAI,CACL,2CAA2C,IAAI,IAAa,CAAC;AAHnD,QAAA,iBAAiB,qBAGkC;AAEnD,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAE9D,QAAA,qBAAqB,GAChC,GAAG,qBAAa,oHAA6H,CAAC;AAEnI,QAAA,qBAAqB,GAChC,GAAG,uBAAe,8HAAuI,CAAC;AAE/I,QAAA,gBAAgB,GAAG,0GAA0G,CAAC;AAE3I,MAAM,gBAAgB,GAAG,2CAA2C,CAAC;AACrE,MAAM,kBAAkB,GAAG,gCAAgC,CAAC;AAC/C,QAAA,8BAA8B,GACzC,uCAAuC,kBAAkB,iCAAiC,gBAAgB,2EAAoF,CAAC","sourcesContent":["export const effectCreator = `PropertyDefinition[value.callee.name='createEffect']`;\nexport const createEffectExpression = `CallExpression[callee.name='createEffect']`;\n\nexport const effectDecorator = `Decorator[expression.callee.name='Effect']`;\nexport const propertyDefinitionWithEffectDecorator =\n `ClassDeclaration > ClassBody > PropertyDefinition > ${effectDecorator}` as const;\n\nexport const actionCreator = `CallExpression[callee.name='createAction']`;\nexport const actionCreatorWithLiteral =\n `${actionCreator}[arguments.0.type='Literal'][arguments.0.raw=/^'/]` as const;\nexport const actionCreatorProps =\n `${actionCreator} > CallExpression[callee.name='props']` as const;\nexport const actionCreatorPropsComputed =\n `${actionCreatorProps} > TSTypeParameterInstantiation > :matches(TSTypeReference[typeName.name!='Readonly'], [type=/^TS(.*)(Keyword|Type)$/])` as const;\n\nexport const constructorDefinition = `MethodDefinition[kind='constructor']`;\n\nexport function metadataProperty(key: RegExp): string;\nexport function metadataProperty<TKey extends string>(\n key: TKey\n): `Property:matches([key.name=${TKey}][computed=false], [key.value=${TKey}], [key.quasis.0.value.raw=${TKey}])`;\nexport function metadataProperty(key: RegExp | string): string {\n return `Property:matches([key.name=${key}][computed=false], [key.value=${key}], [key.quasis.0.value.raw=${key}])`;\n}\n\nexport const ngModuleDecorator = `ClassDeclaration > Decorator > CallExpression[callee.name='NgModule']`;\n\nexport const ngModuleImports =\n `${ngModuleDecorator} ObjectExpression ${metadataProperty(\n 'imports'\n )} > ArrayExpression` as const;\n\nexport const ngModuleProviders =\n `${ngModuleDecorator} ObjectExpression ${metadataProperty(\n 'providers'\n )} > ArrayExpression` as const;\n\nexport const effectsInNgModuleImports =\n `${ngModuleImports} CallExpression[callee.object.name='EffectsModule'][callee.property.name=/^for(Root|Feature)$/] ArrayExpression > Identifier` as const;\n\nexport const effectsInNgModuleProviders =\n `${ngModuleProviders} Identifier` as const;\n\nexport const namedExpression = (name: RegExp | string) =>\n `:matches(${constructorDefinition} CallExpression[callee.object.name=${name}], CallExpression[callee.object.object.type='ThisExpression'][callee.object.property.name=${name}])` as const;\n\nexport const namedCallableExpression = (name: RegExp | string) =>\n `:matches(${namedExpression(\n name\n )}, ${constructorDefinition} CallExpression[callee.object.callee.object.name=${name}], CallExpression[callee.object.callee.object.object.type='ThisExpression'][callee.object.callee.object.property.name=${name}])` as const;\n\nexport const pipeExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='pipe']` as const;\n\nexport const pipeableSelect = (name: RegExp | string) =>\n `${pipeExpression(name)} CallExpression[callee.name='select']` as const;\n\nexport const selectExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='select']` as const;\n\nexport const dispatchExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='dispatch']` as const;\n\nexport const dispatchInEffects = (name: RegExp | string) =>\n `${createEffectExpression} ${dispatchExpression(\n name\n )} > MemberExpression:has(Identifier[name=${name}])` as const;\n\nexport const createReducer = `CallExpression[callee.name='createReducer']`;\n\nexport const onFunctionWithoutType =\n `${createReducer} CallExpression[callee.name='on'] > ArrowFunctionExpression:not([returnType.typeAnnotation], :has(CallExpression))` as const;\n\nexport const storeActionReducerMap =\n `${ngModuleImports} CallExpression[callee.object.name='StoreModule'][callee.property.name=/^for(Root|Feature)$/] > ObjectExpression:first-child` as const;\n\nexport const actionReducerMap = `VariableDeclarator[id.typeAnnotation.typeAnnotation.typeName.name='ActionReducerMap'] > ObjectExpression`;\n\nconst mapLikeOperators = '/^(concat|exhaust|flat|merge|switch)Map$/';\nconst mapLikeToOperators = '/^(concat|merge|switch)MapTo$/';\nexport const mapLikeOperatorCallExpressions =\n `:matches(CallExpression[callee.name=${mapLikeToOperators}], CallExpression[callee.name=${mapLikeOperators}] > :matches(ReturnStatement,ArrowFunctionExpression,FunctionExpression))` as const;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/selectors/index.ts"],"names":[],"mappings":";;;AAqBA,4CAEC;AAvBY,QAAA,aAAa,GAAG,sDAAsD,CAAC;AACvE,QAAA,sBAAsB,GAAG,4CAA4C,CAAC;AAEtE,QAAA,eAAe,GAAG,4CAA4C,CAAC;AAC/D,QAAA,qCAAqC,GAChD,uDAAuD,uBAAe,EAAW,CAAC;AAEvE,QAAA,aAAa,GAAG,4CAA4C,CAAC;AAC7D,QAAA,wBAAwB,GACnC,GAAG,qBAAa,oDAA6D,CAAC;AACnE,QAAA,kBAAkB,GAC7B,GAAG,qBAAa,wCAAiD,CAAC;AACvD,QAAA,0BAA0B,GACrC,GAAG,0BAAkB,yHAAkI,CAAC;AAE7I,QAAA,qBAAqB,GAAG,sCAAsC,CAAC;AAM5E,SAAgB,gBAAgB,CAAC,GAAoB;IACnD,OAAO,8BAA8B,GAAG,iCAAiC,GAAG,8BAA8B,GAAG,IAAI,CAAC;AACpH,CAAC;AAEY,QAAA,iBAAiB,GAAG,uEAAuE,CAAC;AAE5F,QAAA,eAAe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kB,EAC7C,IAAI,CACL,2CAA2C,IAAI,IAAa,CAAC;AAHnD,QAAA,iBAAiB,qBAGkC;AAEnD,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAE9D,QAAA,qBAAqB,GAChC,GAAG,qBAAa,8FAAuG,CAAC;AAE7G,QAAA,qBAAqB,GAChC,GAAG,uBAAe,8HAAuI,CAAC;AAE/I,QAAA,gBAAgB,GAAG,0GAA0G,CAAC;AAE3I,MAAM,gBAAgB,GAAG,2CAA2C,CAAC;AACrE,MAAM,kBAAkB,GAAG,gCAAgC,CAAC;AAC/C,QAAA,8BAA8B,GACzC,uCAAuC,kBAAkB,iCAAiC,gBAAgB,2EAAoF,CAAC","sourcesContent":["export const effectCreator = `PropertyDefinition[value.callee.name='createEffect']`;\nexport const createEffectExpression = `CallExpression[callee.name='createEffect']`;\n\nexport const effectDecorator = `Decorator[expression.callee.name='Effect']`;\nexport const propertyDefinitionWithEffectDecorator =\n `ClassDeclaration > ClassBody > PropertyDefinition > ${effectDecorator}` as const;\n\nexport const actionCreator = `CallExpression[callee.name='createAction']`;\nexport const actionCreatorWithLiteral =\n `${actionCreator}[arguments.0.type='Literal'][arguments.0.raw=/^'/]` as const;\nexport const actionCreatorProps =\n `${actionCreator} > CallExpression[callee.name='props']` as const;\nexport const actionCreatorPropsComputed =\n `${actionCreatorProps} > TSTypeParameterInstantiation > :matches(TSTypeReference[typeName.name!='Readonly'], [type=/^TS(.*)(Keyword|Type)$/])` as const;\n\nexport const constructorDefinition = `MethodDefinition[kind='constructor']`;\n\nexport function metadataProperty(key: RegExp): string;\nexport function metadataProperty<TKey extends string>(\n key: TKey\n): `Property:matches([key.name=${TKey}][computed=false], [key.value=${TKey}], [key.quasis.0.value.raw=${TKey}])`;\nexport function metadataProperty(key: RegExp | string): string {\n return `Property:matches([key.name=${key}][computed=false], [key.value=${key}], [key.quasis.0.value.raw=${key}])`;\n}\n\nexport const ngModuleDecorator = `ClassDeclaration > Decorator > CallExpression[callee.name='NgModule']`;\n\nexport const ngModuleImports =\n `${ngModuleDecorator} ObjectExpression ${metadataProperty(\n 'imports'\n )} > ArrayExpression` as const;\n\nexport const ngModuleProviders =\n `${ngModuleDecorator} ObjectExpression ${metadataProperty(\n 'providers'\n )} > ArrayExpression` as const;\n\nexport const effectsInNgModuleImports =\n `${ngModuleImports} CallExpression[callee.object.name='EffectsModule'][callee.property.name=/^for(Root|Feature)$/] ArrayExpression > Identifier` as const;\n\nexport const effectsInNgModuleProviders =\n `${ngModuleProviders} Identifier` as const;\n\nexport const namedExpression = (name: RegExp | string) =>\n `:matches(${constructorDefinition} CallExpression[callee.object.name=${name}], CallExpression[callee.object.object.type='ThisExpression'][callee.object.property.name=${name}])` as const;\n\nexport const namedCallableExpression = (name: RegExp | string) =>\n `:matches(${namedExpression(\n name\n )}, ${constructorDefinition} CallExpression[callee.object.callee.object.name=${name}], CallExpression[callee.object.callee.object.object.type='ThisExpression'][callee.object.callee.object.property.name=${name}])` as const;\n\nexport const pipeExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='pipe']` as const;\n\nexport const pipeableSelect = (name: RegExp | string) =>\n `${pipeExpression(name)} CallExpression[callee.name='select']` as const;\n\nexport const selectExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='select']` as const;\n\nexport const dispatchExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='dispatch']` as const;\n\nexport const dispatchInEffects = (name: RegExp | string) =>\n `${createEffectExpression} ${dispatchExpression(\n name\n )} > MemberExpression:has(Identifier[name=${name}])` as const;\n\nexport const createReducer = `CallExpression[callee.name='createReducer']`;\n\nexport const onFunctionWithoutType =\n `${createReducer} CallExpression[callee.name='on'] > ArrowFunctionExpression:not([returnType.typeAnnotation])` as const;\n\nexport const storeActionReducerMap =\n `${ngModuleImports} CallExpression[callee.object.name='StoreModule'][callee.property.name=/^for(Root|Feature)$/] > ObjectExpression:first-child` as const;\n\nexport const actionReducerMap = `VariableDeclarator[id.typeAnnotation.typeAnnotation.typeName.name='ActionReducerMap'] > ObjectExpression`;\n\nconst mapLikeOperators = '/^(concat|exhaust|flat|merge|switch)Map$/';\nconst mapLikeToOperators = '/^(concat|merge|switch)MapTo$/';\nexport const mapLikeOperatorCallExpressions =\n `:matches(CallExpression[callee.name=${mapLikeToOperators}], CallExpression[callee.name=${mapLikeOperators}] > :matches(ReturnStatement,ArrowFunctionExpression,FunctionExpression))` as const;\n"]}