Skip to content

Commit 743188b

Browse files
committed
refactor: Add lines-around-comment rule
I often struggle with spacing around block comments, so I've decided to add the `lines-around-comment` lint rule to help manage this. For more details, see the https://eslint.style/rules/js/lines-around-comment
1 parent 6c6248e commit 743188b

File tree

28 files changed

+122
-5
lines changed

28 files changed

+122
-5
lines changed

.eslintrc.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,24 @@
3333
"project": "tsconfig.json",
3434
"sourceType": "module"
3535
},
36-
"plugins": ["eslint-plugin-import", "header", "@typescript-eslint"],
36+
"plugins": ["@stylistic", "@typescript-eslint", "eslint-plugin-import", "header"],
3737
"rules": {
38+
"@stylistic/lines-around-comment": [
39+
"error",
40+
{
41+
"allowArrayStart": true,
42+
"allowBlockStart": true,
43+
"allowClassStart": true,
44+
"allowEnumStart": true,
45+
"allowInterfaceStart": true,
46+
"allowModuleStart": true,
47+
"allowObjectStart": true,
48+
"allowTypeStart": true,
49+
"beforeBlockComment": true,
50+
"ignorePattern": "@license"
51+
}
52+
],
53+
"@stylistic/spaced-comment": ["error", "always"],
3854
"@typescript-eslint/consistent-type-assertions": "error",
3955
"@typescript-eslint/no-explicit-any": "error",
4056
"@typescript-eslint/no-non-null-assertion": "error",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"@listr2/prompt-adapter-inquirer": "2.0.15",
9191
"@rollup/plugin-commonjs": "^26.0.0",
9292
"@rollup/plugin-node-resolve": "^13.0.5",
93+
"@stylistic/eslint-plugin": "^2.8.0",
9394
"@types/babel__core": "7.20.5",
9495
"@types/browser-sync": "^2.27.0",
9596
"@types/express": "^4.16.0",

packages/angular/build/src/builders/dev-server/vite-server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ function getDepOptimizationConfig({
709709
}
710710

711711
const nodeJsBuiltinModules = new Set(builtinModules);
712+
712713
/** Remove any Node.js builtin modules to avoid Vite's prebundling from processing them as files. */
713714
function removeNodeJsBuiltinModules(value: string): boolean {
714715
return !nodeJsBuiltinModules.has(value);

packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export interface CompilerPluginOptions {
3939
sourcemap: boolean | 'external';
4040
tsconfig: string;
4141
jit?: boolean;
42+
4243
/** Skip TypeScript compilation setup. This is useful to re-use the TypeScript compilation from another plugin. */
4344
noopTypeScriptCompilation?: boolean;
4445
advancedOptimizations?: boolean;

packages/angular/build/src/tools/esbuild/i18n-inliner-worker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ interface InlineRequest {
2222
* during Worker initialization.
2323
*/
2424
filename: string;
25+
2526
/**
2627
* The locale specifier that should be used during the inlining process of the file.
2728
*/
2829
locale: string;
30+
2931
/**
3032
* The translation messages for the locale that should be used during the inlining process of the file.
3133
*/

packages/angular/build/src/tools/esbuild/stylesheets/css-inline-fonts-plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { LoadResultCache, createCachedLoad } from '../load-result-cache';
1818
export interface CssInlineFontsPluginOptions {
1919
/** Disk cache normalized options */
2020
cacheOptions?: NormalizedCachedOptions;
21+
2122
/** Load results cache. */
2223
cache?: LoadResultCache;
2324
}

packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ export class StylesheetPluginFactory {
190190
}
191191

192192
private initPostcssCallCount = 0;
193+
193194
/**
194195
* This method should not be called directly.
195196
* Use {@link setupPostcss} instead.

packages/angular/build/src/tools/esbuild/virtual-module-plugin.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,22 @@ import { LoadResultCache, createCachedLoad } from './load-result-cache';
1616
export interface VirtualModulePluginOptions {
1717
/** Namespace. Example: `angular:polyfills`. */
1818
namespace: string;
19+
1920
/** If the generated module should be marked as external. */
2021
external?: boolean;
22+
2123
/** Method to transform the onResolve path. */
2224
transformPath?: (path: string) => string;
25+
2326
/** Method to provide the module content. */
2427
loadContent: (
2528
args: OnLoadArgs,
2629
build: PluginBuild,
2730
) => ReturnType<Parameters<PluginBuild['onLoad']>[1]>;
31+
2832
/** Restrict to only entry points. Defaults to `true`. */
2933
entryPointOnly?: boolean;
34+
3035
/** Load results cache. */
3136
cache?: LoadResultCache;
3237
}

packages/angular/build/src/tools/esbuild/wasm-plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { LoadResultCache, createCachedLoad } from './load-result-cache';
2121
export interface WasmPluginOptions {
2222
/** Allow generation of async (proposal compliant) WASM imports. This requires zoneless to enable async/await. */
2323
allowAsync?: boolean;
24+
2425
/** Load results cache. */
2526
cache?: LoadResultCache;
2627
}

packages/angular/build/src/tools/sass/sass-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export interface SerializableVersion {
5252
export interface SerializableDeprecation extends Omit<Deprecation, 'obsoleteIn' | 'deprecatedIn'> {
5353
/** The version this deprecation first became active in. */
5454
deprecatedIn: SerializableVersion | null;
55+
5556
/** The version this deprecation became obsolete in. */
5657
obsoleteIn: SerializableVersion | null;
5758
}

0 commit comments

Comments
 (0)