Improve formatting (#1814)

* Ignore linting for examples in docs

* Formatting JSX single attribute per line

* Separte `format` and `lint:format` in package.json

* Bump prettier version

* Run format
This commit is contained in:
Han Yeong-woo
2024-02-01 22:38:21 +09:00
committed by GitHub
parent b96e6acd2e
commit eb035fe370
1520 changed files with 3644 additions and 3204 deletions

View File

@@ -35,10 +35,7 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
}
}
}

View File

@@ -3,7 +3,7 @@
// https://karma-runner.github.io/1.0/config/configuration-file.html
process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function(config) {
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],

View File

@@ -22,5 +22,5 @@ import { LucideIconData } from './types';
const ${componentName}: LucideIconData = ${JSON.stringify(children)}; //eslint-disable-line no-shadow-restricted-names
export default ${componentName};
`
`;
};

View File

@@ -63,7 +63,7 @@ describe('LucideAngularComponent', () => {
testHostComponent.setAbsoluteStrokeWidth(true);
testHostFixture.detectChanges();
expect(getSvgAttribute('stroke-width')).toBe(
formatFixed(strokeWidth / (size / defaultAttributes.height))
formatFixed(strokeWidth / (size / defaultAttributes.height)),
);
});

View File

@@ -49,7 +49,7 @@ export class LucideAngularComponent implements OnChanges {
@Inject(Renderer2) private renderer: Renderer2,
@Inject(ChangeDetectorRef) private changeDetector: ChangeDetectorRef,
@Inject(LUCIDE_ICONS) private iconProviders: LucideIconProviderInterface[],
@Inject(LucideIconConfig) private iconConfig: LucideIconConfig
@Inject(LucideIconConfig) private iconConfig: LucideIconConfig,
) {
this.defaultSize = defaultAttributes.height;
}
@@ -99,7 +99,7 @@ export class LucideAngularComponent implements OnChanges {
this.replaceElement(icoOfName);
} else {
throw new Error(
`The "${name}" icon has not been provided by any available icon providers.`
`The "${name}" icon has not been provided by any available icon providers.`,
);
}
} else if (Array.isArray(name)) {
@@ -132,7 +132,7 @@ export class LucideAngularComponent implements OnChanges {
...this.class
.split(/ /)
.map((a) => a.trim())
.filter((a) => a.length > 0)
.filter((a) => a.length > 0),
);
}
const childElements = this.elem.nativeElement.childNodes;
@@ -145,7 +145,7 @@ export class LucideAngularComponent implements OnChanges {
toPascalCase(str: string): string {
return str.replace(
/(\w)([a-z0-9]*)(_|-|\s*)/g,
(g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase()
(g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase(),
);
}
@@ -174,7 +174,7 @@ export class LucideAngularComponent implements OnChanges {
private createElement([tag, attrs, children = []]: readonly [
string,
SvgAttributes,
LucideIconData?
LucideIconData?,
]) {
const element = this.renderer.createElement(tag, 'http://www.w3.org/2000/svg');

View File

@@ -4,22 +4,23 @@ import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
<T>(id: string): T;
keys(): string[];
};
context(
path: string,
deep?: boolean,
filter?: RegExp,
): {
<T>(id: string): T;
keys(): string[];
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);

View File

@@ -10,9 +10,7 @@
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"paths": {
"lucide-angular": [
"dist"
]
"lucide-angular": ["dist"],
},
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
@@ -23,15 +21,12 @@
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"lib": [
"es2020",
"dom"
]
"lib": ["es2020", "dom"],
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
"strictTemplates": true,
},
}

View File

@@ -8,8 +8,5 @@
"inlineSources": true,
"types": []
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
"exclude": ["src/test.ts", "**/*.spec.ts"]
}

View File

@@ -3,15 +3,8 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
"types": ["jasmine"]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
"files": ["src/test.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}