Skip to content

Commit

Permalink
refactor: move ESLint overrides to .eslintrc-overrides.json (#1950)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-SteveBrush authored Jan 22, 2024
1 parent a3ff988 commit 1d3f528
Show file tree
Hide file tree
Showing 27 changed files with 67 additions and 44 deletions.
2 changes: 2 additions & 0 deletions .eslintrc-overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"rules": {
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/explicit-member-accessibility": [
"error",
Expand Down
5 changes: 1 addition & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript", "prettier"],
"rules": {
"@typescript-eslint/no-explicit-any": ["warn", {}],
"@typescript-eslint/no-unused-vars": ["warn", {}]
}
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.0
18.19.0
4 changes: 3 additions & 1 deletion apps/e2e/ag-grid-storybook/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
"plugin:@angular-eslint/template/process-inline-templates",
"../../../.eslintrc-overrides.json",
"prettier"
],
"rules": {
"@angular-eslint/directive-selector": [
Expand Down
2 changes: 1 addition & 1 deletion apps/e2e/ag-grid-storybook/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line @nx/enforce-module-boundaries
// eslint-disable-next-line @nx/enforce-module-boundaries, no-restricted-syntax
export * from '../../../../.storybook/manager';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SkyCellType } from '@skyux/ag-grid';

import { ColDef } from 'ag-grid-community';
import { ColDef, ValueFormatterParams } from 'ag-grid-community';

import { InlineHelpComponent } from './inline-help/inline-help.component';

Expand Down Expand Up @@ -62,7 +62,8 @@ export const columnDefinitions: ColDef[] = [
headerName,
sortable: false,
cellClass: 'booleanType',
valueFormatter: (params: any) => (params.value ? 'Yes' : 'No'),
valueFormatter: (params: ValueFormatterParams) =>
params.value ? 'Yes' : 'No',
})),
{
field: 'vote%',
Expand Down
4 changes: 3 additions & 1 deletion apps/e2e/angular-tree-component-storybook/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
},
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
"plugin:@angular-eslint/template/process-inline-templates",
"../../../.eslintrc-overrides.json",
"prettier"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line @nx/enforce-module-boundaries
// eslint-disable-next-line @nx/enforce-module-boundaries, no-restricted-syntax
export * from '../../../../.storybook/manager';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, inject } from '@angular/core';
import { Component, OnInit, inject } from '@angular/core';
import {
AbstractControl,
FormBuilder,
Expand All @@ -19,7 +19,7 @@ import { delay, distinctUntilChanged } from 'rxjs/operators';
selector: 'app-datepicker',
templateUrl: './datepicker.component.html',
})
export class DatepickerComponent {
export class DatepickerComponent implements OnInit {
public dateFormat: string | undefined = undefined;
public disabled = false;
public minDate: Date | undefined;
Expand Down Expand Up @@ -49,11 +49,11 @@ export class DatepickerComponent {
public ngOnInit(): void {
this.reactiveDate.statusChanges
.pipe(distinctUntilChanged())
.subscribe((status: any) => {
.subscribe((status) => {
console.log('Status changed:', status);
});

this.reactiveDate.valueChanges.subscribe((value: any) => {
this.reactiveDate.valueChanges.subscribe((value) => {
console.log('Value changed:', value);
});
}
Expand Down Expand Up @@ -94,7 +94,8 @@ export class DatepickerComponent {

public setInvalidValue(): void {
this.reactiveDate.setValue('invalid');
(this.selectedDate as any) = 'invalid';
// Calendar works with strings but the API only supports Date or undefined.
this.selectedDate = 'invalid' as unknown as Date;
}

public onToggleCustomDatesClick(): void {
Expand Down
4 changes: 3 additions & 1 deletion apps/e2e/flyout-storybook/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
},
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
"plugin:@angular-eslint/template/process-inline-templates",
"../../../.eslintrc-overrides.json",
"prettier"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion apps/e2e/flyout-storybook/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line @nx/enforce-module-boundaries
// eslint-disable-next-line @nx/enforce-module-boundaries, no-restricted-syntax
export * from '../../../../.storybook/manager';
1 change: 1 addition & 0 deletions apps/e2e/lists-storybook/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ import 'zone.js';
// Fix for crossvent "global is not defined" error. The crossvent library
// is used by Dragula, which in turn is used by multiple SKY UX components.
// See: https://github.com/bevacqua/dragula/issues/602
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).global = window;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FontLoadingService } from '@skyux/storybook';
styleUrls: ['./autocomplete.component.scss'],
})
export class AutocompleteComponent {
public data: any[] = [
public data = [
{ name: 'Red' },
{ name: 'Blue' },
{ name: 'Green' },
Expand Down
4 changes: 3 additions & 1 deletion apps/e2e/modals-storybook/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
"plugin:@angular-eslint/template/process-inline-templates",
"../../../.eslintrc-overrides.json",
"prettier"
],
"rules": {
"@angular-eslint/directive-selector": [
Expand Down
2 changes: 1 addition & 1 deletion apps/e2e/modals-storybook/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line @nx/enforce-module-boundaries
// eslint-disable-next-line @nx/enforce-module-boundaries, no-restricted-syntax
export * from '../../../../.storybook/manager';
4 changes: 3 additions & 1 deletion apps/e2e/theme-storybook/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
"plugin:@angular-eslint/template/process-inline-templates",
"../../../.eslintrc-overrides.json",
"prettier"
],
"rules": {
"@angular-eslint/directive-selector": [
Expand Down
2 changes: 1 addition & 1 deletion apps/e2e/theme-storybook/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line @nx/enforce-module-boundaries
// eslint-disable-next-line @nx/enforce-module-boundaries, no-restricted-syntax
export * from '../../../../.storybook/manager';
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@ import { FormBuilder, FormGroup } from '@angular/forms';
export class SwitchControlsComponent {
public myForm: FormGroup;

public checkboxOptions: any[] = [
public checkboxOptions = [
{ label: 'Checked Checkbox', checked: true, disabled: false },
{ label: 'Unchecked Checkbox', checked: false, disabled: false },
{ label: 'Disabled Checkbox', checked: false, disabled: true },
{ label: 'Disabled Checked Checkbox', checked: true, disabled: true },
];

public checkboxIconGroupOptions: any[] = [
public checkboxIconGroupOptions = [
{ label: 'Bold', checked: true, icon: 'bold', disabled: false },
{ label: 'Italicized', checked: false, icon: 'italic', disabled: false },
{ label: 'Underlined', checked: false, icon: 'underline', disabled: false },
{ label: 'Indent', icon: 'indent', checked: false, disabled: true },
{ label: 'Outdent', icon: 'outdent', checked: true, disabled: true },
];

public radioGroupIconOptions: any[] = [
public radioGroupIconOptions = [
{ name: 'Left align', value: '1', icon: 'align-left', disabled: false },
{ name: 'Center align', value: '2', icon: 'align-center', disabled: false },
{ name: 'Right align', value: '3', icon: 'align-right', disabled: false },
];

public radioGroupIconDisabledOptions: any[] = [
public radioGroupIconDisabledOptions = [
{ name: 'Indent', value: '1', icon: 'indent', disabled: true },
{ name: 'Outdent', value: '2', icon: 'outdent', disabled: true },
];

public radioOptions: any[] = [
public radioOptions = [
{ name: 'Selected radio button', value: '1', disabled: false },
{ name: 'Unselected radio button', value: '2', disabled: false },
{ name: 'Disabled radio button', value: '3', disabled: true },
Expand Down
4 changes: 3 additions & 1 deletion apps/e2e/tiles-storybook/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
"plugin:@angular-eslint/template/process-inline-templates",
"../../../.eslintrc-overrides.json",
"prettier"
],
"rules": {
"@angular-eslint/directive-selector": [
Expand Down
2 changes: 1 addition & 1 deletion apps/e2e/tiles-storybook/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line @nx/enforce-module-boundaries
// eslint-disable-next-line @nx/enforce-module-boundaries, no-restricted-syntax
export * from '../../../../.storybook/manager';
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ describe('ag-grid-29.schematic', () => {
);

async function setupTest(
packageJson: { dependencies?: any } = {},
build: { options?: any } = {},
packageJson: { dependencies?: Record<string, string> } = {},
build: { options?: { styles: string[] } } = {},
appOrLib: 'application' | 'library' = 'application',
) {
): Promise<{ tree: Tree }> {
let tree: Tree;
if (appOrLib === 'application') {
tree = await createTestApp(runner, { projectName: 'test' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import {
updateWorkspace,
} from '../../../utility/workspace';

type PackageJson = {
dependencies: Record<string, string>;
};

describe('MovePageComponentSchematic', () => {
const runner = new SchematicTestRunner(
'schematics',
Expand Down Expand Up @@ -78,7 +82,9 @@ describe('MovePageComponentSchematic', () => {
export class CustomModule {}"
`);
expect(
(result.readJson('package.json') as any).dependencies['@skyux/pages'],
(result.readJson('package.json') as PackageJson).dependencies[
'@skyux/pages'
],
).toEqual('0.0.0');
});

Expand Down Expand Up @@ -144,7 +150,9 @@ describe('MovePageComponentSchematic', () => {
import { AgGridModule } from 'ag-grid-angular';"
`);
expect(
(result.readJson('package.json') as any).dependencies['@skyux/pages'],
(result.readJson('package.json') as PackageJson).dependencies[
'@skyux/pages'
],
).toEqual('0.0.0');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class JsonFile {
}
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
public get(jsonPath: JsonPath): any {
const jsonAstNode = this.#getJsonAst();
if (!jsonAstNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ async function getRemovedSnapshots(
'removed snapshots',
).then((response) =>
response
.filter((snapshot: any) => snapshot.type === 'snapshots')
.filter((snapshot) => snapshot.type === 'snapshots')
.map((snapshot: Snapshot) => snapshot.attributes.name)
.sort((a: string, b: string) => a.localeCompare(b)),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ describe('verify-e2e', () => {
'project-missing',
'project-other',
];
checkPercyBuild.mockImplementation((...args: any) =>
checkPercyBuild.mockImplementation((...args) =>
Promise.resolve({
project: `${args[0]}`,
approved: false,
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"dev:pristine": "skyux-dev pristine-commit"
},
"engines": {
"node": "^18.14.2",
"npm": "^9.5.0"
"node": "^18.19.0",
"npm": "^10.2.3"
},
"config": {
"commitizen": {
Expand Down

0 comments on commit 1d3f528

Please sign in to comment.