Skip to content

Commit

Permalink
Feat/188 (#1437)
Browse files Browse the repository at this point in the history
* feat(ref: #188): add strict eslint rules

* feat(ref: #188): add strict eslint rules

* feat(ref: #188): fix 1410

* feat(ref: #188): change type imports

* fix(ref: #188): rename types, remove zone js
  • Loading branch information
andriikamaldinov1 authored Oct 30, 2024
1 parent b5f37f1 commit 3c818dc
Show file tree
Hide file tree
Showing 64 changed files with 807 additions and 549 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ jobs:
run: |
bun i
bun run build:lib
- name: Setup npm token
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.npm_token }}" > dist/ngx-mask-lib/.npmrc
- name: Publish library
run: bun run publish:lib
run: bun publish:lib
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 18.0.1(2024-10-29)

### Breaking Changes

- rename "IConfig" to "NgxMaskConfig"
- rename "optionsConfig" to "NgxMaskOptions"
- change interface to type

### Fix

- Fix ([#1410](https://github.com/JsDaddy/ngx-mask/issues/1410))

# 17.1.8(2024-07-16)

### Fix

- Fix ([#1344](https://github.com/JsDaddy/ngx-mask/issues/1344))
- Fix ([#1356](https://github.com/JsDaddy/ngx-mask/issues/1356))

# 17.1.8(2024-07-16)

### Fix
Expand Down
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ bootstrapApplication(AppComponent, {
### Passing your own mask config options

```typescript
import { IConfig } from 'ngx-mask'
import { NgxMaskConfig } from 'ngx-mask'

const maskConfig: Partial<IConfig> = {
const maskConfig: Partial<NgxMaskConfig> = {
validation: false,
};

Expand All @@ -90,7 +90,7 @@ bootstrapApplication(AppComponent, {
### Using a function to configure:

```typescript
const maskConfigFunction: () => Partial<IConfig> = () => {
const maskConfigFunction: () => Partial<NgxMaskConfig> = () => {
return {
validation: false,
};
Expand Down Expand Up @@ -144,9 +144,9 @@ Import **ngx-mask** module in Angular app.
### With default mask config options

```typescript
import { NgxMaskModule, IConfig } from 'ngx-mask'
import { NgxMaskModule, NgxMaskConfig } from 'ngx-mask'

export const options: Partial<null|IConfig> | (() => Partial<IConfig>) = null;
export const options: Partial<null | NgxMaskConfig> | (() => Partial<NgxMaskConfig>) = null;

@NgModule({
imports: [
Expand All @@ -158,9 +158,9 @@ export const options: Partial<null|IConfig> | (() => Partial<IConfig>) = null;
### Passing in your own mask config options

```typescript
import { NgxMaskModule, IConfig } from 'ngx-mask'
import { NgxMaskModule, NgxMaskConfig } from 'ngx-mask'

const maskConfig: Partial<IConfig> = {
const maskConfig: Partial<NgxMaskConfig> = {
validation: false,
};

Expand All @@ -174,7 +174,7 @@ const maskConfig: Partial<IConfig> = {
Or using a function to get the config:

```typescript
const maskConfigFunction: () => Partial<IConfig> = () => {
const maskConfigFunction: () => Partial<NgxMaskConfig> = () => {
return {
validation: false,
};
Expand All @@ -193,12 +193,6 @@ Then, just define masks in inputs.

Text [documentation](https://github.com/JsDaddy/ngx-mask/blob/develop/USAGE.md)

## Setup hooks

```bash
$ npm run init:hooks
```

## Contributing

We would love some contributions! Check out this [document](https://github.com/JsDaddy/ngx-mask/blob/develop/CONTRIBUTING.md) to get started.
3 changes: 1 addition & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"extractLicenses": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true,
"polyfills": ["zone.js"]
"namedChunks": true
},
"configurations": {
"production": {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { defineConfig } from 'cypress';

export default defineConfig({
projectId: 'qhyo66',

component: {
devServer: {
framework: 'angular',
bundler: 'webpack',
},
specPattern: 'projects/ngx-mask-lib/src/test/**/*.cy-spec.ts',
},

defaultCommandTimeout: 10000,
});
92 changes: 81 additions & 11 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ module.exports = tseslint.config(
// and treated as if they are HTML files (and therefore have the .html config below applied to them)
processor: angular.processInlineTemplates,
// Override specific rules for TypeScript files (these will take priority over the extended configs above)
languageOptions: {
parserOptions: {
project: ['./tsconfig.eslint.json'],
},
},
rules: {
'@angular-eslint/component-selector': [
'error',
Expand All @@ -68,25 +73,90 @@ module.exports = tseslint.config(
type: 'attribute',
},
],
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-empty-function': [
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/ban-ts-comment': ['error', { minimumDescriptionLength: 10 }],
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-empty-object-type': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-wrapper-object-types': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
'no-array-constructor': 'off',
'no-useless-constructor': 'off',
'no-return-await': 'error',
'no-useless-catch': 'error',
'no-unused-labels': 'error',
'no-unneeded-ternary': 'error',
'no-undef-init': 'error',
'no-regex-spaces': 'error',
'no-proto': 'error',
'no-new-wrappers': 'error',
'no-unused-private-class-members': 'error',
'no-invalid-regexp': 'error',
curly: ['error', 'all'],
'@typescript-eslint/restrict-template-expressions': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/adjacent-overload-signatures': 'error',
'no-console': ['warn'],
'@typescript-eslint/explicit-member-accessibility': 'error',
'@typescript-eslint/no-inferrable-types': ['error', { ignoreParameters: true }],
'no-unused-vars': 'off',
'no-duplicate-imports': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/indent': 0,
'@typescript-eslint/member-delimiter-style': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-use-before-define': 0,
'prefer-const': 1,
'prefer-spread': 1,
'@typescript-eslint/naming-convention': [
'error',
{
allow: ['arrowFunctions', 'functions', 'methods'],
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: true,
},
},
],
'@typescript-eslint/no-explicit-any': [
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': 'off',
'import/prefer-default-export': 'off',
'no-underscore-dangle': 'off',
'class-methods-use-this': 'off',
'lines-between-class-members': 'off',
'no-return-assign': 'off',
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
'no-param-reassign': 'error',
'no-undefined': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-type-assertions': [
'error',
{
ignoreRestArgs: true,
assertionStyle: 'as',
},
],
'no-plusplus': ['off'],
'@typescript-eslint/unbound-method': 'off',
'import/no-cycle': 'off',
'import/extensions': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/consistent-type-exports': 'error',
},
},
{
Expand Down
89 changes: 45 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-mask",
"version": "18.0.0",
"version": "18.0.1",
"description": "Awesome ngx mask",
"license": "MIT",
"engines": {
Expand Down Expand Up @@ -34,7 +34,7 @@
"pack:lib": "cd dist/ngx-mask-lib && npm pack",
"precommit-msg": "echo 'Please wait while we do our pre-commit checks...' && exit 0",
"prettier": "prettier './src/**/*.ts' './projects/**/*.ts' --write",
"publish:lib": "cd dist/ngx-mask-lib && npm publish",
"publish:lib": "cd dist/ngx-mask-lib && bun publish",
"release:major": "bun run version:major && bun run build:lib && bun run pack:lib && bun run publish:lib",
"release:minor": "bun run version:minor && bun run build:lib && bun run pack:lib && bun run publish:lib",
"release:patch": "bun run version:patch && bun run build:lib && bun run pack:lib && bun run publish:lib",
Expand All @@ -60,68 +60,69 @@
"url": "https://github.com/JsDaddy/ngx-mask.git"
},
"dependencies": {
"@angular/animations": "18.1.1",
"@angular/common": "18.1.1",
"@angular/compiler": "18.1.1",
"@angular/core": "18.1.1",
"@angular/forms": "18.1.1",
"@angular/platform-browser": "18.1.1",
"@angular/platform-browser-dynamic": "18.1.1",
"@angular/router": "18.1.1",
"@types/jest": "^29.5.12",
"@types/mocha": "^10.0.7",
"@angular/animations": "18.2.9",
"@angular/common": "18.2.9",
"@angular/compiler": "18.2.9",
"@angular/core": "18.2.9",
"@angular/forms": "18.2.9",
"@angular/platform-browser": "18.2.9",
"@angular/platform-browser-dynamic": "18.2.9",
"@angular/router": "18.2.9",
"@types/jest": "^29.5.14",
"@types/mocha": "^10.0.9",
"ajv": "^8.17.1",
"cypress": "^13.13.1",
"cypress": "^13.15.1",
"highlight.js": "11.10.0",
"ngx-highlightjs": "12.0.0",
"rxjs": "7.8.1",
"semantic-release": "24.0.0",
"semantic-release": "24.2.0",
"semantic-release-export-data": "^1.1.0",
"snyk": "^1.1292.1"
"snyk": "^1.1294.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "18.1.1",
"@angular-eslint/builder": "18.1.0",
"@angular-eslint/eslint-plugin": "18.1.0",
"@angular-eslint/eslint-plugin-template": "18.1.0",
"@angular-eslint/schematics": "18.1.0",
"@angular-eslint/template-parser": "18.1.0",
"@angular/cli": "18.1.1",
"@angular/compiler-cli": "18.1.1",
"@angular/language-service": "18.1.1",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@angular-devkit/build-angular": "18.2.10",
"@angular-eslint/builder": "18.4.0",
"@angular-eslint/eslint-plugin": "18.4.0",
"@angular-eslint/eslint-plugin-template": "18.4.0",
"@angular-eslint/schematics": "18.4.0",
"@angular-eslint/template-parser": "18.4.0",
"@angular/cli": "18.2.10",
"@angular/compiler-cli": "18.2.9",
"@angular/language-service": "18.2.9",
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@jscutlery/cypress-angular": "^0.9.22",
"@types/highlight.js": "9.12.4",
"@types/jasmine": "5.1.4",
"@types/node": "20.14.12",
"@typescript-eslint/eslint-plugin": "7.17.0",
"@typescript-eslint/parser": "7.17.0",
"@web/test-runner": "^0.18.2",
"angular-cli-ghpages": "2.0.1",
"@types/node": "22.8.1",
"@typescript-eslint/eslint-plugin": "8.11.0",
"@typescript-eslint/parser": "8.11.0",
"@web/test-runner": "^0.19.0",
"angular-cli-ghpages": "2.0.3",
"angular-http-server": "1.12.0",
"eslint": "9.7.0",
"eslint": "9.13.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-json": "4.0.0",
"eslint-plugin-json": "4.0.1",
"eslint-plugin-prettier": "5.2.1",
"jasmine-core": "5.2.0",
"jasmine-core": "5.4.0",
"jasmine-spec-reporter": "7.0.0",
"lint-staged": "15.2.7",
"markdownlint-cli": "0.41.0",
"ng-packagr": "18.1.0",
"npm-check-updates": "^16.14.20",
"lint-staged": "15.2.10",
"markdownlint-cli": "0.42.0",
"ng-packagr": "18.2.1",
"npm-check-updates": "^17.1.8",
"postcss-scss": "4.0.9",
"prettier": "3.3.3",
"puppeteer": "22.13.1",
"stylelint": "16.7.0",
"puppeteer": "23.6.0",
"stylelint": "16.10.0",
"stylelint-config-prettier": "9.0.5",
"stylelint-config-recommended-scss": "14.1.0",
"stylelint-prettier": "5.0.2",
"type-coverage": "^2.29.1",
"type-coverage": "^2.29.7",
"typescript": "5.5.4",
"angular-eslint": "^18.1.0",
"typescript-eslint": "^7.17.0",
"tailwindcss": "^3.4.14"
"angular-eslint": "^18.4.0",
"typescript-eslint": "^8.11.0",
"tailwindcss": "^3.4.14",
"bun-types": "^1.1.33"
},
"typeCoverage": {
"atLeast": 92,
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-mask-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-mask",
"version": "18.0.0",
"version": "18.0.1",
"description": "awesome ngx mask",
"keywords": [
"ng2-mask",
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-mask-lib/src/lib/custom-keyboard-event.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare let global: any;

const commonjsGlobal =
Expand All @@ -14,6 +13,7 @@ const commonjsGlobal =

(function () {
if (!commonjsGlobal.KeyboardEvent) {
// eslint-disable-next-line @typescript-eslint/no-empty-function
commonjsGlobal.KeyboardEvent = function (_eventType: any, _init: any) {};
}
})();
Expand Down
Loading

0 comments on commit 3c818dc

Please sign in to comment.