[EC-1051] Add TailwindCSS linting rules (#4605)

This commit is contained in:
Thomas Rittson 2023-02-03 07:27:08 +10:00 committed by GitHub
parent d3539a4a44
commit cc5c753e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 68 additions and 12 deletions

View File

@ -111,9 +111,20 @@
{ {
"files": ["*.html"], "files": ["*.html"],
"parser": "@angular-eslint/template-parser", "parser": "@angular-eslint/template-parser",
"plugins": ["@angular-eslint/template"], "plugins": ["@angular-eslint/template", "tailwindcss"],
"rules": { "rules": {
"@angular-eslint/template/button-has-type": "error" "@angular-eslint/template/button-has-type": "error",
"tailwindcss/no-custom-classname": [
"error",
{
// uses negative lookahead to whitelist any class that doesn't start with "tw-"
// in other words: classnames that start with tw- must be valid TailwindCSS classes
"whitelist": ["(?!(tw)\\-).*"]
}
],
"tailwindcss/enforces-negative-arbitrary-values": "error",
"tailwindcss/enforces-shorthand": "error",
"tailwindcss/no-contradicting-classname": "error"
} }
}, },
{ {

View File

@ -1,3 +1,5 @@
<!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<div <div
class="tw-mx-auto tw-mt-5 tw-flex tw-max-w-lg tw-flex-col tw-items-center tw-justify-center tw-p-8" class="tw-mx-auto tw-mt-5 tw-flex tw-max-w-lg tw-flex-col tw-items-center tw-justify-center tw-p-8"
> >

View File

@ -1,3 +1,5 @@
<!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<form <form
#form #form
(ngSubmit)="submit()" (ngSubmit)="submit()"

View File

@ -1,5 +1,6 @@
<!-- Please remove this disable statement when editing this file! --> <!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable @angular-eslint/template/button-has-type --> <!-- eslint-disable @angular-eslint/template/button-has-type -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<div *ngIf="accountCreateOnly" class=""> <div *ngIf="accountCreateOnly" class="">
<h1 class="tw-mt-12 tw-text-center tw-text-xl">{{ "createAccount" | i18n }}</h1> <h1 class="tw-mt-12 tw-text-center tw-text-xl">{{ "createAccount" | i18n }}</h1>
<div <div

View File

@ -1,5 +1,6 @@
<!-- Please remove this disable statement when editing this file! --> <!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable @angular-eslint/template/button-has-type --> <!-- eslint-disable @angular-eslint/template/button-has-type -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<div class="tw-m-2.5 tw-h-16 tw-text-center"> <div class="tw-m-2.5 tw-h-16 tw-text-center">
<button <button
(click)="selectStep()" (click)="selectStep()"

View File

@ -3,7 +3,7 @@
<div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="confirmUserTitle"> <div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="confirmUserTitle">
<div class="modal-dialog modal-dialog-scrollable" role="document"> <div class="modal-dialog modal-dialog-scrollable" role="document">
<form class="modal-content" #form (ngSubmit)="submit()"> <form class="modal-content" #form (ngSubmit)="submit()">
<h2 class="tw-mt-6 tw-mb-6 tw-pl-3.5 tw-pr-3.5 tw-font-semibold" id="modalTitle | i18n "> <h2 class="tw-my-6 tw-px-3.5 tw-font-semibold" id="modalTitle | i18n ">
{{ modalTitle | i18n | uppercase }} {{ modalTitle | i18n | uppercase }}
</h2> </h2>
<div class="tw-border-0 tw-border-t tw-border-solid tw-border-secondary-300 tw-p-3.5"> <div class="tw-border-0 tw-border-t tw-border-solid tw-border-secondary-300 tw-p-3.5">

View File

@ -1,3 +1,5 @@
<!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<div class="tw-flex"> <div class="tw-flex">
<bit-form-field *ngIf="permissionMode == 'edit'" class="tw-mr-3"> <bit-form-field *ngIf="permissionMode == 'edit'" class="tw-mr-3">
<bit-label>{{ "permission" | i18n }}</bit-label> <bit-label>{{ "permission" | i18n }}</bit-label>
@ -100,7 +102,7 @@
</select> </select>
<label <label
[for]="'permission' + i" [for]="'permission' + i"
class="tw-absolute tw-inset-y-0 tw-right-4 tw-mb-0 tw-block tw-flex tw-items-center" class="tw-absolute tw-inset-y-0 tw-right-4 tw-mb-0 tw-flex tw-items-center"
> >
<i class="bwi bwi-sm bwi-angle-down tw-leading-[0]"></i> <i class="bwi bwi-sm bwi-angle-down tw-leading-[0]"></i>
</label> </label>

View File

@ -1,3 +1,5 @@
<!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="customizeTitle"> <div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="customizeTitle">
<div class="modal-dialog modal-dialog-scrollable tw-w-[600px] tw-max-w-none" role="document"> <div class="modal-dialog modal-dialog-scrollable tw-w-[600px] tw-max-w-none" role="document">
<div class="modal-content"> <div class="modal-content">
@ -21,7 +23,7 @@
{{ error }} {{ error }}
</app-callout> </app-callout>
<p class="tw-text-lg">{{ "pickAnAvatarColor" | i18n }}</p> <p class="tw-text-lg">{{ "pickAnAvatarColor" | i18n }}</p>
<div class="tw-flex tw-flex-wrap tw-justify-center tw-gap-8 tw-gap-y-8"> <div class="tw-flex tw-flex-wrap tw-justify-center tw-gap-8">
<ng-container *ngFor="let c of defaultColorPalette"> <ng-container *ngFor="let c of defaultColorPalette">
<selectable-avatar <selectable-avatar
appStopClick appStopClick
@ -44,7 +46,7 @@
'!tw-outline-[3px] tw-outline-primary-500 hover:tw-outline-[3px] hover:tw-outline-primary-500': '!tw-outline-[3px] tw-outline-primary-500 hover:tw-outline-[3px] hover:tw-outline-primary-500':
customColorSelected customColorSelected
}" }"
class="tw-outline-solid tw-bg-white tw-relative tw-inline-block tw-flex tw-h-24 tw-w-24 tw-cursor-pointer tw-place-content-center tw-content-center tw-justify-center tw-rounded-full tw-border tw-border-solid tw-border-secondary-500 tw-outline tw-outline-0 tw-outline-offset-1 hover:tw-outline-1 hover:tw-outline-primary-300 focus:tw-outline-2 focus:tw-outline-primary-500" class="tw-outline-solid tw-bg-white tw-relative tw-flex tw-h-24 tw-w-24 tw-cursor-pointer tw-place-content-center tw-content-center tw-justify-center tw-rounded-full tw-border tw-border-solid tw-border-secondary-500 tw-outline tw-outline-0 tw-outline-offset-1 hover:tw-outline-1 hover:tw-outline-primary-300 focus:tw-outline-2 focus:tw-outline-primary-500"
[style.background-color]="customColor$ | async" [style.background-color]="customColor$ | async"
> >
<i <i

View File

@ -1,3 +1,5 @@
<!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<form <form
#form #form
(ngSubmit)="submit()" (ngSubmit)="submit()"
@ -48,7 +50,7 @@
/> />
</div> </div>
<div> <div>
<label class="tw-semi-bold tw-text-md tw-ml-1 tw-mt-1 tw-mb-1" for="AccountEncrypted"> <label class="tw-semi-bold tw-text-md tw-my-1 tw-ml-1" for="AccountEncrypted">
{{ "accountRestricted" | i18n }} {{ "accountRestricted" | i18n }}
</label> </label>
</div> </div>
@ -71,7 +73,7 @@
/> />
</div> </div>
<div> <div>
<label class="tw-semi-bold tw-text-md tw-ml-1 tw-mt-1 tw-mb-1" for="FileEncrypted">{{ <label class="tw-semi-bold tw-text-md tw-my-1 tw-ml-1" for="FileEncrypted">{{
"passwordProtected" | i18n "passwordProtected" | i18n
}}</label> }}</label>
</div> </div>

View File

@ -1,3 +1,5 @@
<!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<div <div
class="modal fade" class="modal fade"
role="dialog" role="dialog"
@ -7,11 +9,11 @@
<div class="modal-dialog modal-dialog-scrollable" role="document"> <div class="modal-dialog modal-dialog-scrollable" role="document">
<form #form (ngSubmit)="submit()"> <form #form (ngSubmit)="submit()">
<div class="form-group modal-content"> <div class="form-group modal-content">
<h2 class="tw-mt-6 tw-mb-6 tw-ml-3.5 tw-font-semibold" id="confirmVaultImport"> <h2 class="tw-my-6 tw-ml-3.5 tw-font-semibold" id="confirmVaultImport">
{{ "confirmVaultImport" | i18n | uppercase }} {{ "confirmVaultImport" | i18n | uppercase }}
</h2> </h2>
<div <div
class="tw-border-0 tw-border-t tw-border-solid tw-border-secondary-300 tw-pr-3.5 tw-pt-3.5 tw-pl-3.5" class="tw-border-0 tw-border-t tw-border-solid tw-border-secondary-300 tw-px-3.5 tw-pt-3.5"
> >
{{ "confirmVaultImportDesc" | i18n }} {{ "confirmVaultImportDesc" | i18n }}
<bit-form-field class="tw-pt-3.5"> <bit-form-field class="tw-pt-3.5">
@ -28,7 +30,7 @@
</bit-form-field> </bit-form-field>
</div> </div>
<div <div
class="tw-flex tw-w-full tw-flex-wrap tw-items-center tw-border-0 tw-border-t tw-border-solid tw-border-secondary-300 tw-bg-background-alt tw-pl-3.5 tw-pr-3.5 tw-pb-3.5 tw-pt-4 tw-pl-4 tw-pr-4" class="tw-flex tw-w-full tw-flex-wrap tw-items-center tw-border-0 tw-border-t tw-border-solid tw-border-secondary-300 tw-bg-background-alt tw-px-3.5 tw-pb-3.5 tw-pt-4"
> >
<button bitButton buttonType="primary" class="tw-mr-2" type="submit" appBlurClick> <button bitButton buttonType="primary" class="tw-mr-2" type="submit" appBlurClick>
<span>{{ "importData" | i18n }}</span> <span>{{ "importData" | i18n }}</span>

View File

@ -282,7 +282,7 @@
</svg> </svg>
</span> </span>
<span <span
class="totp-code tw-mr-2 tw-ml-2 tw-mt-1" class="totp-code tw-mx-2 tw-mt-1"
title="{{ 'verificationCodeTotp' | i18n }}" title="{{ 'verificationCodeTotp' | i18n }}"
>{{ totpCodeFormatted }}</span >{{ totpCodeFormatted }}</span
> >

View File

@ -1,5 +1,6 @@
<!-- Please remove this disable statement when editing this file! --> <!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable @angular-eslint/template/button-has-type --> <!-- eslint-disable @angular-eslint/template/button-has-type -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<form [formGroup]="formGroup" [bitSubmit]="submit"> <form [formGroup]="formGroup" [bitSubmit]="submit">
<bit-dialog dialogSize="default" disablePadding> <bit-dialog dialogSize="default" disablePadding>
<ng-container bitDialogTitle>{{ title | i18n }}</ng-container> <ng-container bitDialogTitle>{{ title | i18n }}</ng-container>

View File

@ -1,3 +1,5 @@
<!-- Please remove this disable statement when editing this file! -->
<!-- eslint-disable tailwindcss/no-custom-classname -->
<table class="tw-w-full tw-table-auto tw-leading-normal tw-text-main"> <table class="tw-w-full tw-table-auto tw-leading-normal tw-text-main">
<thead <thead
class="tw-text-bold tw-border-0 tw-border-b-2 tw-border-solid tw-border-secondary-300 tw-text-muted" class="tw-text-bold tw-border-0 tw-border-b-2 tw-border-solid tw-border-secondary-300 tw-text-muted"

27
package-lock.json generated
View File

@ -135,6 +135,7 @@
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.26.0",
"eslint-plugin-rxjs": "^5.0.2", "eslint-plugin-rxjs": "^5.0.2",
"eslint-plugin-rxjs-angular": "^2.0.0", "eslint-plugin-rxjs-angular": "^2.0.0",
"eslint-plugin-tailwindcss": "^3.8.3",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-filter": "^7.0.0", "gulp-filter": "^7.0.0",
"gulp-if": "^3.0.0", "gulp-if": "^3.0.0",
@ -22395,6 +22396,22 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/eslint-plugin-tailwindcss": {
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-tailwindcss/-/eslint-plugin-tailwindcss-3.8.3.tgz",
"integrity": "sha512-wfzfCmc9yONNW+TqfR+QWZ+syFPQ8zMOrIGx500lS4XITEm0HJYGyKh1sC1tQ9+Wmt58bnHzW3Yc31vy5RlJww==",
"dev": true,
"dependencies": {
"fast-glob": "^3.2.5",
"postcss": "^8.4.4"
},
"engines": {
"node": ">=12.13.0"
},
"peerDependencies": {
"tailwindcss": "^3.2.2"
}
},
"node_modules/eslint-scope": { "node_modules/eslint-scope": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
@ -60933,6 +60950,16 @@
"tslib": "^2.0.0" "tslib": "^2.0.0"
} }
}, },
"eslint-plugin-tailwindcss": {
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-tailwindcss/-/eslint-plugin-tailwindcss-3.8.3.tgz",
"integrity": "sha512-wfzfCmc9yONNW+TqfR+QWZ+syFPQ8zMOrIGx500lS4XITEm0HJYGyKh1sC1tQ9+Wmt58bnHzW3Yc31vy5RlJww==",
"dev": true,
"requires": {
"fast-glob": "^3.2.5",
"postcss": "^8.4.4"
}
},
"eslint-scope": { "eslint-scope": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",

View File

@ -98,6 +98,7 @@
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.26.0",
"eslint-plugin-rxjs": "^5.0.2", "eslint-plugin-rxjs": "^5.0.2",
"eslint-plugin-rxjs-angular": "^2.0.0", "eslint-plugin-rxjs-angular": "^2.0.0",
"eslint-plugin-tailwindcss": "^3.8.3",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-filter": "^7.0.0", "gulp-filter": "^7.0.0",
"gulp-if": "^3.0.0", "gulp-if": "^3.0.0",