Skip to content

Commit

Permalink
feat(eslint): prepare migration to typescript-eslint 8.* (#2075)
Browse files Browse the repository at this point in the history
## Proposed change

prepare migration to typescript-eslint 8.*

## Related issues

- 🚀 Pull Request #2027

<!-- Please make sure to follow the contributing guidelines on
https://github.com/amadeus-digital/Otter/blob/main/CONTRIBUTING.md -->
  • Loading branch information
kpanot authored Aug 21, 2024
2 parents f5ba38d + 3ec74d8 commit 7ddcc0c
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export default createRule<[Options, ...any], 'versionUpdate' | 'error'>({
hasSuggestions: true,
type: 'problem',
docs: {
description: 'Ensure that the package dependency versions are aligned with the other package of the workspace.',
recommended: 'strict'
description: 'Ensure that the package dependency versions are aligned with the other packages of the workspace.'
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export default createRule<[Options, ...any], 'tooManyAsyncOnTag'>({
type: 'problem',
hasSuggestions: true,
docs: {
description: 'Ensures that your template does not use too many Async pipes that can slow down your application.',
recommended: 'strict'
description: 'Ensures that your template does not use too many Async pipes that can slow down your application.'
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export default createRule({
type: 'problem',
docs: {
// eslint-disable-next-line max-len
description: 'Ensures that the configuration interface name matches the first parameter of `computeItemIdentifier` (or `computeConfigurationName`) used beside the configuration interface to expose its ID (as generated by the configuration module).',
recommended: 'strict'
description: 'Ensures that the configuration interface name matches the first parameter of `computeItemIdentifier` (or `computeConfigurationName`) used beside the configuration interface to expose its ID (as generated by the configuration module).'
},
schema: [],
messages: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ export default createRule({
hasSuggestions: true,
type: 'problem',
docs: {
description: 'Ensures that imports of modules are pointing to the module file or an index.',
recommended: 'strict'
description: 'Ensures that imports of modules are pointing to the module file or an index.'
},
schema: [],
messages: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export default createRule<[Required<NoMultipleTypeConfigurationPropertyOption>,
hasSuggestions: true,
type: 'problem',
docs: {
description: 'Ensures that the configuration property does not accept multiple types.',
recommended: 'strict'
description: 'Ensures that the configuration property does not accept multiple types.'
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export default createRule<Readonly<[O3rCategoriesTagsRuleOption, ...any]>, Messa
fixable: 'code',
type: 'problem',
docs: {
description: 'Ensures that @o3rCategories and @o3rCategory are used with correct value',
recommended: 'strict'
description: 'Ensures that @o3rCategories and @o3rCategory are used with a correct value'
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ export default createRule<[Readonly<O3rWidgetTagsRuleOption>, ...any], O3rWidget
fixable: 'code',
type: 'problem',
docs: {
description: 'Ensures that @o3rWidget and @o3rWidgetParam are used with correct value',
recommended: 'strict'
description: 'Ensures that @o3rWidget and @o3rWidgetParam are used with a correct value'
},
schema: [
{
Expand Down
4 changes: 3 additions & 1 deletion packages/@o3r/eslint-plugin/src/rules/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ESLintUtils, TSESLint, TSESTree } from '@typescript-eslint/utils';
import { readFileSync } from 'node:fs';
import * as path from 'node:path';
import type { PackageJson } from 'type-fest';

/** Current package version (format: <major>.<minor>)*/
const version = (require(path.resolve(__dirname, '..', '..', 'package.json')) as {version: string}).version.split('.').slice(0,2).join('.');
const version = (JSON.parse(readFileSync(path.resolve(__dirname, '..', '..', 'package.json'), { encoding: 'utf-8' })) as PackageJson).version?.split('.').slice(0,2).join('.') || '0.0';

/** ESLint rule generator */
// eslint-disable-next-line new-cap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export default createRule<[Options, ...any], 'versionUpdate' | 'error'>({
hasSuggestions: true,
type: 'problem',
docs: {
description: 'Ensure that the package extension versions are aligned with range defined in packages.',
recommended: 'strict'
description: 'Ensure that the package extension versions are aligned with the range defined in the packages.'
},
schema: [
{
Expand Down

0 comments on commit 7ddcc0c

Please sign in to comment.