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

chore(eslint): add eslint-plugin-import dependency #2842

Merged
merged 27 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f2ca203
add eslint-plugin-import dependency
csouchet Sep 1, 2023
49e9d8a
add plugin:import/recommended rules
csouchet Sep 1, 2023
107f4b5
Add typescript support
csouchet Sep 1, 2023
0fb105c
add eslint-import-resolver-typescript dependency
csouchet Sep 1, 2023
733fff3
fix in tests: import/no-unresolved
csouchet Sep 1, 2023
edc2651
fix: Multiple exports of name 'IconPainter' import/export
csouchet Sep 1, 2023
429d899
fix: Unable to resolve path to module 'fs-extra/esm' import/no-unres…
csouchet Sep 1, 2023
666e8c1
fix: Unable to resolve path to module 'rollup-plugin-node-externals' …
csouchet Sep 1, 2023
662ab46
fix : Unable to resolve path to module 'bpmn-visualization' import/n…
csouchet Sep 1, 2023
d36e87a
add import/newline-after-import rule
csouchet Sep 1, 2023
681bb50
run linting
csouchet Sep 1, 2023
b31ccf1
add import/first rule
csouchet Sep 1, 2023
268f3b0
run linting
csouchet Sep 1, 2023
313aadb
add import/order rule
csouchet Sep 1, 2023
be7f3bb
run linting
csouchet Sep 1, 2023
121dd19
revert bad change
csouchet Sep 1, 2023
fdda22f
revert bad change
csouchet Sep 1, 2023
1727933
ignore require
csouchet Sep 1, 2023
713799a
fix package.json declaration
csouchet Sep 4, 2023
d540ffc
move comments
csouchet Sep 4, 2023
26caaee
Change the way to fix in /test/typescript-support/src/index.ts:
csouchet Sep 4, 2023
e8a9bad
Merge branch 'master' into 2742-add_eslint-plugin-import
csouchet Sep 4, 2023
ea85fa4
Merge branch 'master' into 2742-add_eslint-plugin-import
csouchet Sep 4, 2023
2f46484
Merge branch 'master' into 2742-add_eslint-plugin-import
csouchet Sep 5, 2023
a145aaf
Merge branch 'master' into 2742-add_eslint-plugin-import
csouchet Sep 6, 2023
68b84ff
Apply suggestions from code review
csouchet Sep 6, 2023
d066927
fix lint
csouchet Sep 6, 2023
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
26 changes: 25 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ limitations under the License.

module.exports = {
root: true,
plugins: ['notice', 'unicorn'],
plugins: ['notice', 'unicorn', 'import'],
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
'plugin:import/recommended',
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
Expand All @@ -39,6 +40,20 @@ module.exports = {
},
},
],
'import/newline-after-import': ['error', { count: 1 }],
'import/first': 'error',
'import/order': [
'error',
{
groups: ['type', 'builtin', 'external', 'parent', 'sibling', 'index', 'internal'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
orderImportKind: 'asc',
caseInsensitive: true,
},
},
],
},
overrides: [
// typescript
Expand All @@ -48,7 +63,16 @@ module.exports = {
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
'plugin:@typescript-eslint/stylistic',
'plugin:import/typescript',
],
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
project: '**/tsconfig.json',
},
},
},
parserOptions: {
// This setting is required if you want to use rules which require type information
// https://typescript-eslint.io/packages/parser/#project
Expand Down
3 changes: 2 additions & 1 deletion dev/ts/component/SvgExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { mxgraph, mxClient, mxConstants, mxSvgCanvas2D, mxUtils } from '../../../src/component/mxgraph/initializer';
import type { mxGraph, mxSvgCanvas2D as mxSvgCanvas2DType } from 'mxgraph';

import { mxgraph, mxClient, mxConstants, mxSvgCanvas2D, mxUtils } from '../../../src/component/mxgraph/initializer';

interface SvgExportOptions {
scale: number;
border: number;
Expand Down
2 changes: 1 addition & 1 deletion dev/ts/component/ThemedBpmnVisualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

import { BpmnVisualization, FlowKind, ShapeBpmnElementKind, ShapeUtil, StyleConfigurator, StyleDefault } from '../../../src/bpmn-visualization';
import { logStartup } from '../shared/internal-helpers';
import { mxConstants } from '../../../src/component/mxgraph/initializer';
import { logStartup } from '../shared/internal-helpers';

interface Theme {
defaultFillColor: string;
Expand Down
1 change: 1 addition & 0 deletions dev/ts/pages/elements-identification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
*/

import type { BpmnElementKind, BpmnSemantic, Overlay, ShapeStyleUpdate, StyleUpdate } from '../dev-bundle-index';

import {
addCssClasses,
addOverlays,
Expand Down
1 change: 1 addition & 0 deletions dev/ts/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
*/

import type { FitOptions, FitType } from '../dev-bundle-index';

import {
documentReady,
handleFileSelect,
Expand Down
1 change: 1 addition & 0 deletions dev/ts/pages/overlays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
*/

import type { Overlay, OverlayPosition } from '../dev-bundle-index';

import { addOverlays, configureControlsPanel, configureMousePointer, documentReady, getModelElementsByIds, removeAllOverlays, startBpmnVisualization } from '../dev-bundle-index';

const bpmnIdInputElt = document.getElementById('bpmn-id-input') as HTMLInputElement;
Expand Down
10 changes: 6 additions & 4 deletions dev/ts/shared/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import type { mxCell } from 'mxgraph';
import type {
BpmnElementKind,
BpmnSemantic,
Expand All @@ -31,14 +30,17 @@ import type {
Version,
ZoomType,
} from '../../../src/bpmn-visualization';
import type { mxCell } from 'mxgraph';

import { FlowKind, ShapeBpmnElementKind } from '../../../src/bpmn-visualization';
import { fetchBpmnContent, logDownload, logError, logErrorAndOpenAlert, logStartup } from './internal-helpers';
import { log } from './shared-helpers';
import { downloadAsPng, downloadAsSvg } from '../component/download';
import { DropFileUserInterface } from '../component/DropFileUserInterface';
import { SvgExporter } from '../component/SvgExporter';
import { downloadAsPng, downloadAsSvg } from '../component/download';
import { ThemedBpmnVisualization } from '../component/ThemedBpmnVisualization';

import { fetchBpmnContent, logDownload, logError, logErrorAndOpenAlert, logStartup } from './internal-helpers';
import { log } from './shared-helpers';

let bpmnVisualization: ThemedBpmnVisualization;
let loadOptions: LoadOptions = {};
let statusKoNotifier: (errorMsg: string) => void;
Expand Down
Loading