Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance lint to check imports and fix import orders #124

Merged
merged 6 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ extends:
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:wc/recommended
- plugin:import/recommended
- plugin:import/typescript

env:
browser: true
Expand All @@ -18,9 +20,14 @@ parserOptions:

plugins:
- "@typescript-eslint"
- import
- wc

settings:
import/resolver:
typescript:
alwaysTryTypes: true
project: "package/*/tsconfig.json"
wc:
elementBaseClasses:
- LitElement
Expand All @@ -36,7 +43,22 @@ rules:
no-floating-decimal: error
space-infix-ops: error
"@typescript-eslint/explicit-function-return-type": error
"import/order":
- error
- groups:
- "builtin"
- "external"
- "internal"
- - "parent"
- "sibling"
- "index"
- "type"
"newlines-between": "always"
alphabetize:
order: asc
caseInsensitive: true

# TODO: Enable in future
import/no-unresolved: off
require-jsdoc: off
valid-jsdoc: off
1 change: 0 additions & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
],
"dependencies": {
"@alwatr/logger": "^0.9.0",
"lit": "^2.1.3",
"tslib": "^2.2.0"
}
}
1 change: 1 addition & 0 deletions demo/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import {router} from '@alwatr/router';

import type {Route, RoutesConfig} from '@alwatr/router';

/**
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@typescript-eslint/parser": "^5.16.0",
"@web/dev-server": "^0.1.30",
"eslint": "^8.10.0",
"eslint-config-google": "^0.14.0",
"eslint-import-resolver-typescript": "^2.7.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-wc": "^1.3.2",
"lerna": "^4.0.0",
"npm-run-all": "^4.1.5",
Expand Down
4 changes: 3 additions & 1 deletion package/i18n/src/core.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {createLogger, alwatrRegisteredList} from '@alwatr/logger';
import {getJson} from '@alwatr/fetch';
import {createLogger, alwatrRegisteredList} from '@alwatr/logger';

import {l10nResourceChangeSignal, localChangeSignal} from './signal';

import type {I18nOptions, L10Resource} from './type';

export {localChangeSignal, l10nResourceChangeSignal};
Expand Down
2 changes: 2 additions & 0 deletions package/i18n/src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {logger, _localize, configuration} from './core';
import {localChangeSignal, l10nResourceChangeSignal} from './signal';

import type {I18nOptions, Local} from './type';

export {localChangeSignal, l10nResourceChangeSignal};

export type {Local};

/**
Expand Down
1 change: 1 addition & 0 deletions package/i18n/src/signal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SignalInterface} from '@alwatr/signal';

import {L10Resource, Local} from './type';

declare global {
Expand Down
1 change: 1 addition & 0 deletions package/router/src/core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {createLogger, alwatrRegisteredList} from '@alwatr/logger';

import type {ParamList, RequestRouteParam, Route} from './type';

alwatrRegisteredList.push({
Expand Down
2 changes: 1 addition & 1 deletion package/router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {routeChangeSignal} from './signal';
import {clickTrigger} from './trigger-click';
import {popstateTrigger} from './trigger-popstate';

import type {SignalInterface} from '@alwatr/signal';
import type {InitOptions, Route, RoutesConfig} from './type';
import type {SignalInterface} from '@alwatr/signal';

export {routeChangeSignal};
export type {Route, RequestRouteParam, RoutesConfig} from './type';
Expand Down
1 change: 1 addition & 0 deletions package/router/src/signal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SignalInterface} from '@alwatr/signal';

import type {RequestRouteParam, Route} from './type';

declare global {
Expand Down
1 change: 1 addition & 0 deletions package/signal/src/core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {createLogger, alwatrRegisteredList} from '@alwatr/logger';

import type {
DispatchOptions,
ListenerCallback,
Expand Down
1 change: 1 addition & 0 deletions package/signal/src/signal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {createLogger} from '@alwatr/logger';

import {
__getSignalObject,
_removeSignalListener,
Expand Down
Loading