@centreon/js-config 23.10.3 → 23.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,11 +21,15 @@ module.exports = {
21
21
  }
22
22
  ],
23
23
  '@typescript-eslint/camelcase': 'off',
24
- '@typescript-eslint/consistent-type-definitions': [
24
+ '@typescript-eslint/consistent-type-definitions': ['off', 'interface'],
25
+ '@typescript-eslint/explicit-function-return-type': [
25
26
  'error',
26
- 'interface'
27
+ {
28
+ allowExpressions: true,
29
+ allowHigherOrderFunctions: true,
30
+ allowTypedFunctionExpressions: true
31
+ }
27
32
  ],
28
- '@typescript-eslint/explicit-function-return-type': ['error'],
29
33
  '@typescript-eslint/explicit-member-accessibility': [
30
34
  'error',
31
35
  {
@@ -76,13 +80,21 @@ module.exports = {
76
80
  }
77
81
  ],
78
82
  camelcase: 'off',
83
+ 'import/no-cycle': 'off',
84
+ 'import/no-named-as-default': 'warn',
79
85
  'no-shadow': 'off',
80
86
  'no-unused-expressions': 'off'
81
87
  },
82
88
  settings: {
89
+ 'import/parsers': {
90
+ '@typescript-eslint/parser': ['.ts', '.tsx']
91
+ },
83
92
  'import/resolver': {
84
93
  alias: {
85
94
  extensions: ['.ts', '.tsx', '.js', '.jsx']
95
+ },
96
+ typescript: {
97
+ alwaysTryTypes: true
86
98
  }
87
99
  }
88
100
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@centreon/js-config",
3
3
  "description": "Centreon Frontend shared build configuration",
4
- "version": "23.10.3",
4
+ "version": "23.10.4",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"
@@ -23,6 +23,7 @@
23
23
  "eslint-config-airbnb": "19.0.4",
24
24
  "eslint-config-prettier": "^8.5.0",
25
25
  "eslint-import-resolver-alias": "^1.1.2",
26
+ "eslint-import-resolver-typescript": "^3.5.5",
26
27
  "eslint-plugin-babel": "^5.3.1",
27
28
  "eslint-plugin-hooks": "^0.4.3",
28
29
  "eslint-plugin-import": "^2.26.0",
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "moduleResolution": "node",
3
+ "moduleResolution": "nodenext",
4
4
  "downlevelIteration": true,
5
- "module": "es6",
6
- "target": "es6",
5
+ "module": "esnext",
6
+ "target": "es2018",
7
7
  "jsx": "react-jsx",
8
8
  "strict": true,
9
9
  "noImplicitAny": false,
10
10
  "skipLibCheck": true,
11
- "esModuleInterop": true
11
+ "esModuleInterop": true,
12
+ "resolveJsonModule": true
12
13
  }
13
14
  }
@@ -0,0 +1,74 @@
1
+ const excludeNodeModulesExceptCentreonUi =
2
+ /node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
3
+
4
+ module.exports = {
5
+ cache: false,
6
+ excludeNodeModulesExceptCentreonUi,
7
+ getModuleConfiguration: (jscTransformConfiguration) => ({
8
+ rules: [
9
+ {
10
+ parser: { system: false },
11
+ test: /\.[cm]?(j|t)sx?$/
12
+ },
13
+ {
14
+ exclude: [
15
+ excludeNodeModulesExceptCentreonUi,
16
+ /www(\\|\/)widgets(\\|\/)bruh/
17
+ ],
18
+ test: /\.[jt]sx?$/,
19
+ use: {
20
+ loader: 'swc-loader',
21
+ options: {
22
+ jsc: {
23
+ parser: {
24
+ syntax: 'typescript',
25
+ tsx: true
26
+ },
27
+ transform: jscTransformConfiguration
28
+ }
29
+ }
30
+ }
31
+ },
32
+ {
33
+ test: /\.icon.svg$/,
34
+ use: ['@svgr/webpack']
35
+ },
36
+ {
37
+ exclude: excludeNodeModulesExceptCentreonUi,
38
+ test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
39
+ use: [
40
+ {
41
+ loader: 'url-loader',
42
+ options: {
43
+ limit: 10000,
44
+ name: '[name].[hash:8].[ext]'
45
+ }
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ generator: {
51
+ filename: '[name][ext]'
52
+ },
53
+ test: /\.(woff|woff2|eot|ttf|otf)$/i,
54
+ type: 'asset/resource'
55
+ },
56
+ {
57
+ test: /\.css$/i,
58
+ use: ['style-loader', 'css-loader']
59
+ }
60
+ ]
61
+ }),
62
+ optimization: {
63
+ splitChunks: {
64
+ chunks: 'all',
65
+ maxSize: 400 * 1024
66
+ }
67
+ },
68
+ output: {
69
+ chunkFilename: '[name].[chunkhash:8].chunk.js',
70
+ filename: '[name].[chunkhash:8].js',
71
+ libraryTarget: 'umd',
72
+ umdNamedDefine: true
73
+ }
74
+ };
@@ -3,75 +3,22 @@ const path = require('path');
3
3
  const { CleanWebpackPlugin } = require('clean-webpack-plugin');
4
4
  const { ModuleFederationPlugin } = require('webpack').container;
5
5
 
6
- const excludeNodeModulesExceptCentreonUi =
7
- /node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
6
+ const {
7
+ getModuleConfiguration,
8
+ optimization,
9
+ output,
10
+ cache
11
+ } = require('./globalConfig');
8
12
 
9
13
  const getBaseConfiguration = ({
10
14
  moduleName,
11
15
  moduleFederationConfig,
12
16
  jscTransformConfiguration
13
17
  }) => ({
14
- cache: false,
15
- module: {
16
- rules: [
17
- {
18
- parser: { system: false },
19
- test: /\.[cm]?(j|t)sx?$/
20
- },
21
- {
22
- exclude: excludeNodeModulesExceptCentreonUi,
23
- test: /\.[jt]sx?$/,
24
- use: {
25
- loader: 'swc-loader',
26
- options: {
27
- jsc: {
28
- parser: {
29
- syntax: 'typescript',
30
- tsx: true
31
- },
32
- transform: jscTransformConfiguration
33
- }
34
- }
35
- }
36
- },
37
- {
38
- test: /\.icon.svg$/,
39
- use: ['@svgr/webpack']
40
- },
41
- {
42
- exclude: excludeNodeModulesExceptCentreonUi,
43
- test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
44
- use: [
45
- {
46
- loader: 'url-loader',
47
- options: {
48
- limit: 10000,
49
- name: '[name].[hash:8].[ext]'
50
- }
51
- }
52
- ]
53
- },
54
- {
55
- generator: {
56
- filename: '[name][ext]'
57
- },
58
- test: /\.(woff|woff2|eot|ttf|otf)$/i,
59
- type: 'asset/resource'
60
- }
61
- ]
62
- },
63
- optimization: {
64
- splitChunks: {
65
- chunks: 'all',
66
- maxSize: 400 * 1024
67
- }
68
- },
69
- output: {
70
- chunkFilename: '[name].[chunkhash:8].chunk.js',
71
- filename: '[name].[chunkhash:8].js',
72
- libraryTarget: 'umd',
73
- umdNamedDefine: true
74
- },
18
+ cache,
19
+ module: getModuleConfiguration(jscTransformConfiguration),
20
+ optimization,
21
+ output,
75
22
  plugins: [
76
23
  new CleanWebpackPlugin(),
77
24
  moduleName &&