Skip to content

Commit

Permalink
fix(eslint): fix typescript import resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu-crouzet committed Nov 22, 2024
1 parent 8399ca1 commit cce253b
Show file tree
Hide file tree
Showing 70 changed files with 239 additions and 196 deletions.
3 changes: 3 additions & 0 deletions apps/vscode-extension/eslint.local.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export default [
'tsconfig.spec.json'
]
}
},
settings: {
'import/core-modules': ['vscode']
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion apps/vscode-extension/src/commands/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
posix,
relative,
} from 'node:path';
import * as vscode from 'vscode';
import type {
WorkspaceSchema,
} from '@o3r/schematics';
import * as vscode from 'vscode';

/**
* Get the local path of the folder of the current open file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import {
import {
posix,
} from 'node:path';
import * as vscode from 'vscode';
import type {
ExtensionContext,
} from 'vscode';
import type {
NpmRegistryPackage,
NPMRegistrySearchResponse,
OTTER_MODULE_KEYWORD as OTTER_MODULE_KEYWORD_TYPE,
OTTER_MODULE_SUPPORTED_SCOPES as OTTER_MODULE_SUPPORTED_SCOPES_TYPE,
} from '@o3r/schematics';
import * as vscode from 'vscode';
import type {
ExtensionContext,
} from 'vscode';
import {
getPackageScriptRunner,
} from '../helpers';
Expand Down
12 changes: 6 additions & 6 deletions apps/vscode-extension/src/intellisense/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import {
CompletionItem,
CompletionItemKind,
CompletionItemProvider,
SnippetString,
} from 'vscode';
import type {
O3rCategoriesTagsRuleOption,
O3rWidgetTagsRuleOption,
Expand All @@ -8,12 +14,6 @@ import type {
import {
ESLint,
} from 'eslint';
import {
CompletionItem,
CompletionItemKind,
CompletionItemProvider,
SnippetString,
} from 'vscode';

interface ConfigurationTags {
/** @see CompletionItem.documentation */
Expand Down
12 changes: 6 additions & 6 deletions apps/vscode-extension/src/intellisense/design-token.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import * as path from 'node:path';
import {
type DesignTokenVariableSet,
type DesignTokenVariableStructure,
getCssTokenValueRenderer,
parseDesignTokenFile,
} from '@o3r/design';
import {
CompletionItem,
CompletionItemKind,
CompletionItemProvider,
HoverProvider,
} from 'vscode';
import * as vscode from 'vscode';
import {
type DesignTokenVariableSet,
type DesignTokenVariableStructure,
getCssTokenValueRenderer,
parseDesignTokenFile,
} from '@o3r/design';

type DesignTokenCache = {
lastExtractionTimestamp: number;
Expand Down
1 change: 0 additions & 1 deletion eslint.local.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default [
parser: yamlParser
}
},

{
name: '@o3r/framework/yarnrc',
files: ['.yarnrc.yml'],
Expand Down
16 changes: 14 additions & 2 deletions eslint.shared.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import o3rTemplate from '@o3r/eslint-config/template';
import nxPlugin from '@nx/eslint-plugin';
import o3rConfig from '@o3r/eslint-config';
import o3rTemplate from '@o3r/eslint-config/template';
import o3rPlugin from '@o3r/eslint-plugin';
import globals from 'globals';
import jsonParser from 'jsonc-eslint-parser';
Expand Down Expand Up @@ -42,13 +42,25 @@ export default [
{
name: '@o3r/framework/settings',
settings: {
'import/resolver': 'node'
'import/resolver': {
node: true,
typescript: {
project: './tsconfig.base.json'
}
}
},
languageOptions: {
sourceType: 'module',
ecmaVersion: 12
}
},
{
name: '@o3r/framework/setup-jest-files',
files: ['**/setup-jest.ts'],
settings: {
'import/core-modules': ['isomorphic-fetch']
}
},
{
name: '@o3r/framework/commonjs',
files: ['**/*.cjs'],
Expand Down
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"{projectRoot}/src/**/*.cjs",
"{workspaceRoot}/eslint*.config.mjs",
"{workspaceRoot}/packages/@o3r/eslint-config/src/**/*.ts",
"{workspaceRoot}/packages/@o3r/eslint-plugin/src/**/*.ts"
"{workspaceRoot}/packages/@o3r/eslint-plugin/src/**/*.cjs"
],
"specs": [
"base",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
RequestBody,
} from '../../plugins/index';

Expand Down
2 changes: 1 addition & 1 deletion packages/@ama-sdk/core/src/fwk/mocks/mock-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
EncodedApiRequest,
} from './encoded-api-request';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
MockAdapter,
} from '../../fwk/index';
import {
Expand Down
18 changes: 9 additions & 9 deletions packages/@ama-sdk/schematics/cli/update-spec-from-npm.cts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ import {
extname,
posix,
} from 'node:path';
import type {
OpenApiToolsConfiguration,
OpenApiToolsGenerator,
} from '@ama-sdk/schematics';
import {
LOCAL_SPEC_FILENAME,
SPEC_JSON_EXTENSION,
SPEC_YAML_EXTENSION,
} from '@ama-sdk/schematics';
import type {
CliWrapper,
} from '@o3r/telemetry';
import * as minimist from 'minimist';
import type {
PackageJson,
} from 'type-fest';
import {
LOCAL_SPEC_FILENAME,
SPEC_JSON_EXTENSION,
SPEC_YAML_EXTENSION,
} from '@ama-sdk/schematics';
import type {
OpenApiToolsConfiguration,
OpenApiToolsGenerator,
} from '@ama-sdk/schematics';

const argv = minimist(process.argv.slice(2));
const packageName = argv._[0];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import * as path from 'node:path';
import type {
OpenApiToolsConfiguration,
} from '@ama-sdk/schematics';
import {
LOCAL_SPEC_FILENAME,
SPEC_JSON_EXTENSION,
SPEC_YAML_EXTENSION,
} from '@ama-sdk/schematics';
import {
Tree,
} from '@angular-devkit/schematics';
Expand All @@ -17,6 +9,14 @@ import {
import type {
JsonObject,
} from 'type-fest';
import {
LOCAL_SPEC_FILENAME,
SPEC_JSON_EXTENSION,
SPEC_YAML_EXTENSION,
} from '@ama-sdk/schematics';
import type {
OpenApiToolsConfiguration,
} from '@ama-sdk/schematics';

const collectionPath = path.join(__dirname, '..', '..', '..', 'collection.json');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import * as path from 'node:path';
import type {
OpenApiToolsConfiguration,
} from '@ama-sdk/schematics';
import {
Tree,
} from '@angular-devkit/schematics';
Expand All @@ -13,6 +10,9 @@ import type {
JsonObject,
PackageJson,
} from 'type-fest';
import type {
OpenApiToolsConfiguration,
} from '@ama-sdk/schematics';

const collectionPath = path.join(__dirname, '..', '..', '..', 'collection.json');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ export default [
ecmaVersion: 12
},
settings: {
'import/resolver': 'node'
'import/resolver': {
node: true,
typescript: {
project: './tsconfig.base.json'
}
}
}
},
{
Expand All @@ -60,6 +65,20 @@ export default [
'/jest.config.js'
]
},
{
name: '@o3r-training/showcase-sdk/typescript-files',
files: ['**/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'max-len': 'off',
'no-redeclare': 'off',
'no-use-before-define': 'off',
'no-useless-escape': 'off',
'import/export': 'off'
}
},
{
name: '<%= projectPackageName %>/helpers',
files: ['*.helper.ts'],
Expand Down
6 changes: 6 additions & 0 deletions packages/@ama-sdk/swagger-builder/eslint.local.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@ export default [
...globals.node
}
}
},
{
name: '@ama-sdk/swagger-builder/overrides',
rules: {
'import/no-cycle': 'off'
}
}
];
3 changes: 2 additions & 1 deletion packages/@o3r-training/showcase-sdk/eslint.local.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export default [
'max-len': 'off',
'no-redeclare': 'off',
'no-use-before-define': 'off',
'no-useless-escape': 'off'
'no-useless-escape': 'off',
'import/export': 'off'
}
},
{
Expand Down
1 change: 0 additions & 1 deletion packages/@o3r-training/showcase-sdk/src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './base';
export * from './core';
export * from './custom';

export * from './enums';
export * from './patterns';
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import * as path from 'node:path';
import {
logging,
} from '@angular-devkit/core';
import type {
ComponentStructure,
} from '@o3r/components';
import {
getLocalizationFileFromAngularElement,
} from '@o3r/extractors';
import {
isO3rClassComponent,
} from '@o3r/schematics';
import * as ts from 'typescript';
import type {
ComponentStructure,
} from '@o3r/components';

/** Information extracted from a component file */
export interface ComponentInformation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ import {
import {
logging,
} from '@angular-devkit/core';
import type {
ConfigProperty,
ConfigPropertyTypes,
ConfigType,
NestedConfiguration,
} from '@o3r/components';
import type {
CategoryDescription,
ItemIdentifier,
Expand All @@ -21,6 +15,12 @@ import {
O3rCliError,
} from '@o3r/schematics';
import * as ts from 'typescript';
import type {
ConfigProperty,
ConfigPropertyTypes,
ConfigType,
NestedConfiguration,
} from '@o3r/components';

/** Information extracted from a configuration file */
export interface ConfigurationInformation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ import * as path from 'node:path';
import {
logging,
} from '@angular-devkit/core';
import type {
ComponentClassOutput,
ComponentConfigOutput,
ComponentOutput,
ComponentStructure,
ConfigProperty,
PlaceholdersMetadata,
} from '@o3r/components';
import {
CmsMetadataData,
getLibraryCmsMetadata,
Expand All @@ -31,6 +23,14 @@ import {
import {
ParserOutput,
} from './component.parser';
import type {
ComponentClassOutput,
ComponentConfigOutput,
ComponentOutput,
ComponentStructure,
ConfigProperty,
PlaceholdersMetadata,
} from '@o3r/components';

/**
* Extracts components metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import {
import type {
LoggerApi,
} from '@angular-devkit/core/src/logger';
import type {
ComponentConfigOutput,
} from '@o3r/components';
import {
CmsMetadataData,
createBuilderWithMetricsIfInstalled,
Expand All @@ -27,6 +24,9 @@ import {
import {
ComponentExtractorBuilderSchema,
} from './schema';
import type {
ComponentConfigOutput,
} from '@o3r/components';

export * from './schema';

Expand Down
Loading

0 comments on commit cce253b

Please sign in to comment.