Browse Source

fix lint errors & remove unused function

pull/13886/head
muhammedaltug 4 years ago
parent
commit
c49ff88d6e
  1. 3
      npm/ng-packs/packages/schematics/src/commands/api/index.ts
  2. 2
      npm/ng-packs/packages/schematics/src/commands/create-lib/files-package/__libraryName@kebab__/tsconfig.lib.json.template
  3. 9
      npm/ng-packs/packages/schematics/src/commands/create-lib/index.ts
  4. 4
      npm/ng-packs/packages/schematics/src/commands/proxy-add/index.ts
  5. 4
      npm/ng-packs/packages/schematics/src/commands/proxy-index/index.ts
  6. 4
      npm/ng-packs/packages/schematics/src/commands/proxy-refresh/index.ts
  7. 4
      npm/ng-packs/packages/schematics/src/commands/proxy-remove/index.ts
  8. 4
      npm/ng-packs/packages/schematics/src/models/api-definition.ts
  9. 1
      npm/ng-packs/packages/schematics/src/utils/index.ts
  10. 9
      npm/ng-packs/packages/schematics/src/utils/lib.ts
  11. 7
      npm/ng-packs/packages/schematics/src/utils/workspace.ts

3
npm/ng-packs/packages/schematics/src/commands/api/index.ts

@ -4,7 +4,6 @@ import {
branchAndMerge,
chain,
move,
SchematicContext,
SchematicsException,
Tree,
url,
@ -36,7 +35,7 @@ export default function (schema: GenerateProxySchema) {
const moduleName = params.module || 'app';
return chain([
async (tree: Tree, _context: SchematicContext) => {
async (tree: Tree) => {
const getRootNamespace = createRootNamespaceGetter(params);
const solution = await getRootNamespace(tree);

2
npm/ng-packs/packages/schematics/src/commands/create-lib/files-package/__libraryName@kebab__/tsconfig.lib.json.template

@ -3,7 +3,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,

9
npm/ng-packs/packages/schematics/src/commands/create-lib/index.ts

@ -4,7 +4,6 @@ import {
move,
noop,
Rule,
SchematicContext,
SchematicsException,
Tree,
url,
@ -59,7 +58,7 @@ async function checkLibExist(options: GenerateLibSchema, tree: Tree) {
}
function createLibrary(options: GenerateLibSchema): Rule {
return async (tree: Tree, _context: SchematicContext) => {
return async (tree: Tree) => {
const target = await resolveProject(tree, options.packageName, null);
if (!target || options.override) {
if (options.isModuleTemplate) {
@ -83,9 +82,7 @@ async function resolvePackagesDirFromAngularJson(host: Tree) {
function readFirstLibInAngularJson(workspace: WorkspaceDefinition): ProjectDefinition | undefined {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_, props] =
Array.from(workspace.projects.entries()).find(([_, value]) => isLibrary(value)) || [];
return props;
return Array.from(workspace.projects.values()).find(value => isLibrary(value));
}
async function createLibFromModuleTemplate(tree: Tree, options: GenerateLibSchema) {
@ -107,7 +104,7 @@ async function createLibFromModuleTemplate(tree: Tree, options: GenerateLibSchem
}
export function addLibToWorkspaceIfNotExist(name: string, packagesDir: string): Rule {
return async (tree: Tree, _: SchematicContext) => {
return async (tree: Tree) => {
const workspace = await getWorkspace(tree);
const packageName = kebab(name);
const isProjectExist = workspace.projects.has(packageName);

4
npm/ng-packs/packages/schematics/src/commands/proxy-add/index.ts

@ -1,4 +1,4 @@
import { chain, SchematicContext, Tree } from '@angular-devkit/schematics';
import { chain, Tree } from '@angular-devkit/schematics';
import { GenerateProxySchema } from '../../models';
import {
buildTargetPath,
@ -19,7 +19,7 @@ export default function (schema: GenerateProxySchema) {
const moduleName = params.module || 'app';
return chain([
async (host: Tree, _context: SchematicContext) => {
async (host: Tree) => {
const target = await resolveProject(host, params.target!);
const targetPath = buildTargetPath(target.definition, params.entryPoint);
const readProxyConfig = createProxyConfigReader(targetPath);

4
npm/ng-packs/packages/schematics/src/commands/proxy-index/index.ts

@ -1,4 +1,4 @@
import { SchematicContext, Tree } from '@angular-devkit/schematics';
import { Tree } from '@angular-devkit/schematics';
import {
buildTargetPath,
createProxyIndexGenerator,
@ -9,7 +9,7 @@ import {
export default function (schema: { target?: string; entryPoint?: string }) {
const params = removeDefaultPlaceholders(schema);
return async (host: Tree, _context: SchematicContext) => {
return async (host: Tree) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const target = await resolveProject(host, params.target!);
const targetPath = buildTargetPath(target.definition, params.entryPoint);

4
npm/ng-packs/packages/schematics/src/commands/proxy-refresh/index.ts

@ -1,4 +1,4 @@
import { chain, SchematicContext, Tree } from '@angular-devkit/schematics';
import { chain, Tree } from '@angular-devkit/schematics';
import { GenerateProxySchema } from '../../models';
import {
buildTargetPath,
@ -16,7 +16,7 @@ import {
export default function (schema: GenerateProxySchema) {
const params = removeDefaultPlaceholders(schema);
return async (host: Tree, _context: SchematicContext) => {
return async (host: Tree) => {
const target = await resolveProject(host, params.target!);
const targetPath = buildTargetPath(target.definition, params.entryPoint);

4
npm/ng-packs/packages/schematics/src/commands/proxy-remove/index.ts

@ -1,4 +1,4 @@
import { chain, SchematicContext, Tree } from '@angular-devkit/schematics';
import { chain, Tree } from '@angular-devkit/schematics';
import { GenerateProxySchema } from '../../models';
import {
buildTargetPath,
@ -17,7 +17,7 @@ export default function (schema: GenerateProxySchema) {
const params = removeDefaultPlaceholders(schema);
const moduleName = params.module || 'app';
return async (host: Tree, _context: SchematicContext) => {
return async (host: Tree) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const target = await resolveProject(host, params.target!);
const targetPath = buildTargetPath(target.definition, params.entryPoint);

4
npm/ng-packs/packages/schematics/src/models/api-definition.ts

@ -56,6 +56,8 @@ export interface ParameterInSignature {
type: string;
typeSimple: string;
isOptional: boolean;
// eslint-disable-next-line
// @typescript-eslint/no-explicit-any
defaultValue: any;
}
@ -66,6 +68,8 @@ export interface ParameterInBody {
type: string;
typeSimple: string;
isOptional: boolean;
// eslint-disable-next-line
// @typescript-eslint/no-explicit-any
defaultValue: any;
constraintTypes: string[] | null;
bindingSourceId: eBindingSourceId;

1
npm/ng-packs/packages/schematics/src/utils/index.ts

@ -7,7 +7,6 @@ export * from './enum';
export * from './file';
export * from './generics';
export * from './import';
export * from './lib';
export * from './methods';
export * from './model';
export * from './namespace';

9
npm/ng-packs/packages/schematics/src/utils/lib.ts

@ -1,9 +0,0 @@
import { Tree } from '@angular-devkit/schematics';
import { resolveProject } from "./workspace";
export async function createTargetLibIfNotExist(tree: Tree, target: string) {
const lib = await resolveProject(tree, target, null);
if (!lib) {
}
}

7
npm/ng-packs/packages/schematics/src/utils/workspace.ts

@ -35,9 +35,13 @@ export function readWorkspaceSchema(tree: Tree) {
return workspaceSchema;
}
// eslint-disable-next-line
// @typescript-eslint/no-explicit-any
export async function resolveProject<T = any>(
tree: Tree,
name: string,
// eslint-disable-next-line
// @typescript-eslint/no-explicit-any
notFoundValue: T = NOT_FOUND_VALUE as unknown as any,
): Promise<Project | T> {
name = name || readWorkspaceSchema(tree).defaultProject!;
@ -83,7 +87,8 @@ export function getWorkspaceSchema(host: Tree): WorkspaceSchema {
throw new SchematicsException(`Could not find (${path})`);
}
const content = configBuffer.toString();
// eslint-disable-next-line
// @typescript-eslint/no-explicit-any
return parseJson(content) as Record<string, any> as WorkspaceSchema;
}

Loading…
Cancel
Save