at-builder 1.2.6 → 1.2.7

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.
@@ -5,7 +5,10 @@
5
5
  "Bash(node:*)",
6
6
  "Bash(npx tsc:*)",
7
7
  "Bash(find:*)",
8
- "Bash(rm:*)"
8
+ "Bash(rm:*)",
9
+ "Bash(npm ls:*)",
10
+ "Bash(ls:*)",
11
+ "Bash(npx eslint:*)"
9
12
  ],
10
13
  "deny": []
11
14
  }
@@ -0,0 +1,56 @@
1
+ /* eslint-disable no-undef */
2
+ const globals = require("globals");
3
+
4
+ module.exports = [
5
+ {
6
+ files: ["**/*.{js,mjs,cjs,ts}"],
7
+ languageOptions: {
8
+ ecmaVersion: "latest",
9
+ sourceType: "module",
10
+ globals: {
11
+ ...globals.browser,
12
+ ...globals.es2021,
13
+ ...globals.jquery,
14
+ document: "readonly",
15
+ Microsoft: "readonly",
16
+ navigator: "readonly",
17
+ window: "readonly",
18
+ utag_data: "readonly",
19
+ utag: "readonly",
20
+ docCookies: "readonly"
21
+ }
22
+ },
23
+ rules: {
24
+ 'no-var': 'error',
25
+ 'no-unused-vars': [
26
+ 'error',
27
+ {
28
+ args: 'none',
29
+ caughtErrors: 'none',
30
+ ignoreRestSiblings: true,
31
+ vars: 'all'
32
+ }
33
+ ],
34
+ 'no-undef': 'error',
35
+ 'prefer-const': [
36
+ 'error',
37
+ {
38
+ destructuring: 'all'
39
+ }
40
+ ],
41
+ 'indent': ['error', 4],
42
+ 'no-debugger': 'warn',
43
+ 'eqeqeq': ['error', 'always', { null: 'ignore' }],
44
+ 'no-trailing-spaces': 'error',
45
+ 'semi': 'off',
46
+ 'no-console': 'warn'
47
+ }
48
+ },
49
+ {
50
+ ignores: [
51
+ '**/node_modules/**',
52
+ 'dist/**',
53
+ 'build/**'
54
+ ]
55
+ }
56
+ ];
@@ -0,0 +1,130 @@
1
+ /* eslint-disable no-undef */
2
+ const { ESLint } = require('eslint');
3
+ const path = require('path');
4
+
5
+ class ESLintFlatConfigPlugin {
6
+ constructor(options = {}) {
7
+ this.options = {
8
+ context: options.context || process.cwd(),
9
+ configFile: options.configFile,
10
+ overrideConfigFiles: options.overrideConfigFiles || [], // Array of additional config files
11
+ failOnError: options.failOnError !== false,
12
+ failOnWarning: options.failOnWarning || false,
13
+ fix: options.fix || false, // Enable auto-fix
14
+ extensions: options.extensions || ['js', 'ts'],
15
+ ...options
16
+ };
17
+ }
18
+
19
+ apply(compiler) {
20
+ const pluginName = 'ESLintFlatConfigPlugin';
21
+
22
+ compiler.hooks.compilation.tap(pluginName, (compilation) => {
23
+ compilation.hooks.finishModules.tapPromise(pluginName, async (modules) => {
24
+ const filesToLint = [];
25
+
26
+ for (const module of modules) {
27
+ if (module.resource) {
28
+ // Skip node_modules
29
+ if (module.resource.includes('node_modules')) {
30
+ continue;
31
+ }
32
+
33
+ const ext = path.extname(module.resource).slice(1);
34
+ if (this.options.extensions.includes(ext)) {
35
+ filesToLint.push(module.resource);
36
+ }
37
+ }
38
+ }
39
+
40
+ if (filesToLint.length === 0) return;
41
+
42
+ try {
43
+ // Load base config
44
+ let baseConfig = [];
45
+ if (this.options.configFile && require('fs').existsSync(this.options.configFile)) {
46
+ delete require.cache[require.resolve(this.options.configFile)];
47
+ baseConfig = require(this.options.configFile);
48
+ }
49
+
50
+ // Load and merge override configs
51
+ const overrideConfigs = [];
52
+ for (const configPath of this.options.overrideConfigFiles) {
53
+ try {
54
+ const resolvedPath = path.resolve(this.options.context, configPath);
55
+ if (require('fs').existsSync(resolvedPath)) {
56
+ delete require.cache[require.resolve(resolvedPath)];
57
+ const config = require(resolvedPath);
58
+ overrideConfigs.push(...(Array.isArray(config) ? config : [config]));
59
+ }
60
+ } catch (err) {
61
+ // Silently skip if config doesn't exist
62
+ }
63
+ }
64
+
65
+ // Merge all configs (base + overrides)
66
+ const mergedConfig = [
67
+ ...(Array.isArray(baseConfig) ? baseConfig : [baseConfig]),
68
+ ...overrideConfigs
69
+ ];
70
+
71
+ const eslint = new ESLint({
72
+ cwd: this.options.context,
73
+ overrideConfig: mergedConfig,
74
+ ignore: false, // Don't use default ignore patterns
75
+ fix: this.options.fix // Enable auto-fix if option is set
76
+ });
77
+
78
+ const results = await eslint.lintFiles(filesToLint);
79
+
80
+ // Apply fixes if enabled
81
+ if (this.options.fix) {
82
+ await ESLint.outputFixes(results);
83
+ }
84
+
85
+ let hasErrors = false;
86
+ let hasWarnings = false;
87
+
88
+ for (const result of results) {
89
+ if (result.errorCount > 0) {
90
+ hasErrors = true;
91
+ for (const message of result.messages.filter(m => m.severity === 2)) {
92
+ const error = new Error(
93
+ `[ESLint] ${result.filePath}:${message.line}:${message.column}\n ${message.message} (${message.ruleId})`
94
+ );
95
+ error.file = result.filePath;
96
+ compilation.errors.push(error);
97
+ }
98
+ }
99
+
100
+ if (result.warningCount > 0) {
101
+ hasWarnings = true;
102
+ for (const message of result.messages.filter(m => m.severity === 1)) {
103
+ const warning = new Error(
104
+ `[ESLint] ${result.filePath}:${message.line}:${message.column}\n ${message.message} (${message.ruleId})`
105
+ );
106
+ warning.file = result.filePath;
107
+ compilation.warnings.push(warning);
108
+ }
109
+ }
110
+ }
111
+
112
+ if (this.options.failOnError && hasErrors) {
113
+ throw new Error('[ESLint] Build failed due to linting errors');
114
+ }
115
+
116
+ if (this.options.failOnWarning && hasWarnings) {
117
+ throw new Error('[ESLint] Build failed due to linting warnings');
118
+ }
119
+ } catch (error) {
120
+ if (error.message.includes('Build failed')) {
121
+ throw error;
122
+ }
123
+ compilation.errors.push(error);
124
+ }
125
+ });
126
+ });
127
+ }
128
+ }
129
+
130
+ module.exports = ESLintFlatConfigPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "at-builder",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "main": "bin/index.js",
5
5
  "bin": {
6
6
  "atb": "bin/index.js"
package/webpack.config.js CHANGED
@@ -1,13 +1,10 @@
1
- /* eslint-disable no-undef */
2
- /* eslint-disable @typescript-eslint/no-require-imports */
3
-
4
1
  const path = require('path');
5
2
  const fs = require('fs');
6
3
  const dotenv = require('dotenv');
7
4
  const { Compilation } = require('webpack');
8
5
  const WrapperPlugin = require('./lib/CustomWrapperPlugin');
9
6
  const TerserPlugin = require('terser-webpack-plugin');
10
- const ESLintPlugin = require('eslint-webpack-plugin');
7
+ const ESLintFlatConfigPlugin = require('./lib/eslint-flat-config-plugin');
11
8
  const postcssPresetEnv = require('postcss-preset-env');
12
9
  const AdobeTargetBuildGeneratorPlugin = require('./lib/at-build-generator.cjs');
13
10
 
@@ -41,7 +38,7 @@ let ignoreFolders = [
41
38
 
42
39
 
43
40
 
44
- let count = 0;
41
+
45
42
  /**
46
43
  * Method to traverse folder recursively
47
44
  * @param {*} dir - Directory name
@@ -130,10 +127,17 @@ files.forEach((file) => {
130
127
  const isProdMode = environment == PRODUCTION;
131
128
 
132
129
  const plugins = [
133
- new ESLintPlugin({
134
- extensions: "js",
135
- outputReport: true,
136
- fix: true
130
+ new ESLintFlatConfigPlugin({
131
+ extensions: ["js", "ts"],
132
+ context: PWD,
133
+ configFile: path.resolve(__dirname, 'eslint.config.js'),
134
+ overrideConfigFiles: [
135
+ 'eslint.config.js' // Load project-specific overrides from PWD if exists
136
+ ],
137
+ fix: !isProdMode, // Auto-fix in development mode only
138
+ failOnError: isProdMode, // Fail on errors in production
139
+ failOnWarning: false,
140
+ fix: false
137
141
  }),
138
142
  new WrapperPlugin({
139
143
  test: /\.js$/,
@@ -254,7 +258,8 @@ module.exports = {
254
258
  use: {
255
259
  loader: 'ts-loader',
256
260
  options: {
257
- transpileOnly: true
261
+ transpileOnly: true,
262
+ configFile: path.resolve(__dirname, './tsconfig.json'),
258
263
  }
259
264
  },
260
265
  exclude: /node_modules/,
@@ -265,7 +270,8 @@ module.exports = {
265
270
  use: {
266
271
  loader: 'babel-loader',
267
272
  options: {
268
- presets: ['@babel/preset-env']
273
+ presets: ['@babel/preset-env'],
274
+ configFile: path.resolve(__dirname, './babel.config.js'),
269
275
  }
270
276
  }
271
277
  },
package/.eslintrc DELETED
@@ -1,526 +0,0 @@
1
- {
2
- "parser": "@babel/eslint-parser",
3
- "parserOptions": {
4
- "ecmaVersion": "latest",
5
- "sourceType": "module",
6
- "es6": true
7
- },
8
- "env": {
9
- "es2021": true,
10
- "browser": true,
11
- "jquery": true
12
- },
13
- "globals": {
14
- "document": "readonly",
15
- "navigator": "readonly",
16
- "window": "readonly",
17
- "utag_data": "readonly",
18
- "utag": "readonly",
19
- "process": "readonly"
20
- },
21
- "ignorePatterns": [
22
- "webpack.config.js",
23
- "puppeteer.js",
24
- "plopfile.js",
25
- "build.js",
26
- "babel.config.js",
27
- "at-build-generator.js"
28
- ],
29
- "rules": {
30
- "no-var": "warn",
31
- "accessor-pairs": [
32
- "error",
33
- {
34
- "setWithoutGet": true,
35
- "enforceForClassMembers": true
36
- }
37
- ],
38
- "array-bracket-spacing": [
39
- "error",
40
- "never"
41
- ],
42
- "array-callback-return": [
43
- "error",
44
- {
45
- "allowImplicit": false,
46
- "checkForEach": false
47
- }
48
- ],
49
- "arrow-spacing": [
50
- "error",
51
- {
52
- "before": true,
53
- "after": true
54
- }
55
- ],
56
- "block-spacing": [
57
- "error",
58
- "always"
59
- ],
60
- "brace-style": [
61
- "error",
62
- "1tbs",
63
- {
64
- "allowSingleLine": true
65
- }
66
- ],
67
- "camelcase": [
68
- "error",
69
- {
70
- "allow": [
71
- "^UNSAFE_"
72
- ],
73
- "properties": "never",
74
- "ignoreGlobals": true
75
- }
76
- ],
77
- "comma-dangle": [
78
- "error",
79
- {
80
- "arrays": "never",
81
- "objects": "never",
82
- "imports": "never",
83
- "exports": "never",
84
- "functions": "never"
85
- }
86
- ],
87
- "comma-spacing": [
88
- "error",
89
- {
90
- "before": false,
91
- "after": true
92
- }
93
- ],
94
- "comma-style": [
95
- "error",
96
- "last"
97
- ],
98
- "computed-property-spacing": [
99
- "error",
100
- "never",
101
- {
102
- "enforceForClassMembers": true
103
- }
104
- ],
105
- "constructor-super": "error",
106
- "curly": [
107
- "error",
108
- "multi-line"
109
- ],
110
- "default-case-last": "error",
111
- "dot-location": [
112
- "error",
113
- "property"
114
- ],
115
- "dot-notation": [
116
- "error",
117
- {
118
- "allowKeywords": true
119
- }
120
- ],
121
- "eol-last": "warn",
122
- "eqeqeq": [
123
- "error",
124
- "always",
125
- {
126
- "null": "ignore"
127
- }
128
- ],
129
- "func-call-spacing": [
130
- "error",
131
- "never"
132
- ],
133
- "generator-star-spacing": [
134
- "error",
135
- {
136
- "before": true,
137
- "after": true
138
- }
139
- ],
140
- "indent": [
141
- "error",
142
- 4
143
- ],
144
- "key-spacing": [
145
- "error",
146
- {
147
- "beforeColon": false,
148
- "afterColon": true
149
- }
150
- ],
151
- "keyword-spacing": [
152
- "error",
153
- {
154
- "before": true,
155
- "after": true
156
- }
157
- ],
158
- "lines-between-class-members": [
159
- "error",
160
- "always",
161
- {
162
- "exceptAfterSingleLine": true
163
- }
164
- ],
165
- "multiline-ternary": [
166
- "error",
167
- "always-multiline"
168
- ],
169
- "new-cap": [
170
- "error",
171
- {
172
- "newIsCap": true,
173
- "capIsNew": false,
174
- "properties": true
175
- }
176
- ],
177
- "new-parens": "error",
178
- "no-array-constructor": "error",
179
- "no-async-promise-executor": "error",
180
- "no-caller": "error",
181
- "no-case-declarations": "error",
182
- "no-class-assign": "error",
183
- "no-compare-neg-zero": "error",
184
- "no-cond-assign": "error",
185
- "no-const-assign": "error",
186
- "no-constant-condition": [
187
- "error",
188
- {
189
- "checkLoops": false
190
- }
191
- ],
192
- "no-control-regex": "error",
193
- "no-debugger": "off",
194
- "no-delete-var": "error",
195
- "no-dupe-args": "error",
196
- "no-dupe-class-members": "error",
197
- "no-dupe-keys": "error",
198
- "no-duplicate-case": "error",
199
- "no-useless-backreference": "error",
200
- "no-empty": [
201
- "error",
202
- {
203
- "allowEmptyCatch": true
204
- }
205
- ],
206
- "no-empty-character-class": "error",
207
- "no-empty-pattern": "error",
208
- "no-eval": "error",
209
- "no-ex-assign": "error",
210
- "no-extend-native": "error",
211
- "no-extra-bind": "error",
212
- "no-extra-boolean-cast": "error",
213
- "no-extra-parens": [
214
- "error",
215
- "functions"
216
- ],
217
- "no-fallthrough": "error",
218
- "no-floating-decimal": "error",
219
- "no-func-assign": "error",
220
- "no-global-assign": "error",
221
- "no-implied-eval": "error",
222
- "no-import-assign": "error",
223
- "no-invalid-regexp": "error",
224
- "no-irregular-whitespace": "error",
225
- "no-iterator": "error",
226
- "no-labels": [
227
- "error",
228
- {
229
- "allowLoop": false,
230
- "allowSwitch": false
231
- }
232
- ],
233
- "no-lone-blocks": "error",
234
- "no-loss-of-precision": "error",
235
- "no-misleading-character-class": "error",
236
- "no-prototype-builtins": "error",
237
- "no-useless-catch": "error",
238
- "no-mixed-operators": [
239
- "error",
240
- {
241
- "groups": [
242
- [
243
- "==",
244
- "!=",
245
- "===",
246
- "!==",
247
- ">",
248
- ">=",
249
- "<",
250
- "<="
251
- ],
252
- [
253
- "&&",
254
- "||"
255
- ],
256
- [
257
- "in",
258
- "instanceof"
259
- ]
260
- ],
261
- "allowSamePrecedence": true
262
- }
263
- ],
264
- "no-mixed-spaces-and-tabs": "error",
265
- "no-multi-spaces": "error",
266
- "no-multi-str": "error",
267
- "no-multiple-empty-lines": [
268
- "error",
269
- {
270
- "max": 1,
271
- "maxEOF": 0
272
- }
273
- ],
274
- "no-new": "error",
275
- "no-new-func": "error",
276
- "no-new-object": "error",
277
- "no-new-symbol": "error",
278
- "no-new-wrappers": "error",
279
- "no-obj-calls": "error",
280
- "no-octal": "error",
281
- "no-octal-escape": "error",
282
- "no-proto": "error",
283
- "no-redeclare": [
284
- "error",
285
- {
286
- "builtinGlobals": false
287
- }
288
- ],
289
- "no-regex-spaces": "error",
290
- "no-return-assign": [
291
- "error",
292
- "except-parens"
293
- ],
294
- "no-self-assign": [
295
- "error",
296
- {
297
- "props": true
298
- }
299
- ],
300
- "no-self-compare": "error",
301
- "no-sequences": "error",
302
- "no-shadow-restricted-names": "error",
303
- "no-sparse-arrays": "error",
304
- "no-tabs": "error",
305
- "no-template-curly-in-string": "error",
306
- "no-this-before-super": "error",
307
- "no-throw-literal": "error",
308
- "no-trailing-spaces": "error",
309
- "no-undef": "error",
310
- "no-undef-init": "error",
311
- "no-unexpected-multiline": "error",
312
- "no-unmodified-loop-condition": "error",
313
- "no-unneeded-ternary": [
314
- "error",
315
- {
316
- "defaultAssignment": false
317
- }
318
- ],
319
- "no-unreachable": "error",
320
- "no-unreachable-loop": "error",
321
- "no-unsafe-finally": "error",
322
- "no-unsafe-negation": "error",
323
- "no-unused-expressions": [
324
- "error",
325
- {
326
- "allowShortCircuit": true,
327
- "allowTernary": true,
328
- "allowTaggedTemplates": true
329
- }
330
- ],
331
- "no-unused-vars": [
332
- "error",
333
- {
334
- "args": "none",
335
- "caughtErrors": "none",
336
- "ignoreRestSiblings": true,
337
- "vars": "all"
338
- }
339
- ],
340
- "no-use-before-define": [
341
- "error",
342
- {
343
- "functions": false,
344
- "classes": false,
345
- "variables": false
346
- }
347
- ],
348
- "no-useless-call": "error",
349
- "no-useless-computed-key": "error",
350
- "no-useless-constructor": "error",
351
- "no-useless-escape": "error",
352
- "no-useless-rename": "error",
353
- "no-useless-return": "error",
354
- "no-void": "error",
355
- "no-whitespace-before-property": "error",
356
- "no-with": "error",
357
- "object-curly-newline": [
358
- "error",
359
- {
360
- "multiline": true,
361
- "consistent": true
362
- }
363
- ],
364
- "object-curly-spacing": [
365
- "error",
366
- "always"
367
- ],
368
- "object-property-newline": [
369
- "error",
370
- {
371
- "allowMultiplePropertiesPerLine": true
372
- }
373
- ],
374
- "one-var": [
375
- "error",
376
- {
377
- "initialized": "never"
378
- }
379
- ],
380
- "operator-linebreak": [
381
- "error",
382
- "after",
383
- {
384
- "overrides": {
385
- "?": "before",
386
- ":": "before",
387
- "|>": "before"
388
- }
389
- }
390
- ],
391
- "padded-blocks": [
392
- "error",
393
- {
394
- "blocks": "never",
395
- "switches": "never",
396
- "classes": "never"
397
- }
398
- ],
399
- "prefer-const": [
400
- "error",
401
- {
402
- "destructuring": "all"
403
- }
404
- ],
405
- "prefer-promise-reject-errors": "error",
406
- "prefer-regex-literals": [
407
- "error",
408
- {
409
- "disallowRedundantWrapping": true
410
- }
411
- ],
412
- "quote-props": [
413
- "error",
414
- "as-needed"
415
- ],
416
- "quotes": [
417
- "error",
418
- "single",
419
- {
420
- "avoidEscape": true,
421
- "allowTemplateLiterals": false
422
- }
423
- ],
424
- "rest-spread-spacing": [
425
- "error",
426
- "never"
427
- ],
428
- "semi-spacing": [
429
- "error",
430
- {
431
- "before": false,
432
- "after": true
433
- }
434
- ],
435
- "space-before-blocks": [
436
- "off",
437
- "always"
438
- ],
439
- "space-before-function-paren": [
440
- "off",
441
- "always"
442
- ],
443
- "space-in-parens": [
444
- "error",
445
- "never"
446
- ],
447
- "space-infix-ops": "error",
448
- "space-unary-ops": [
449
- "error",
450
- {
451
- "words": true,
452
- "nonwords": false
453
- }
454
- ],
455
- "spaced-comment": [
456
- "error",
457
- "always",
458
- {
459
- "line": {
460
- "markers": [
461
- "*package",
462
- "!",
463
- "/",
464
- ",",
465
- "="
466
- ]
467
- },
468
- "block": {
469
- "balanced": true,
470
- "markers": [
471
- "*package",
472
- "!",
473
- ",",
474
- ":",
475
- "::",
476
- "flow-include"
477
- ],
478
- "exceptions": [
479
- "*"
480
- ]
481
- }
482
- }
483
- ],
484
- "symbol-description": "error",
485
- "template-curly-spacing": [
486
- "error",
487
- "never"
488
- ],
489
- "template-tag-spacing": [
490
- "error",
491
- "never"
492
- ],
493
- "unicode-bom": [
494
- "error",
495
- "never"
496
- ],
497
- "use-isnan": [
498
- "error",
499
- {
500
- "enforceForSwitchCase": true,
501
- "enforceForIndexOf": true
502
- }
503
- ],
504
- "valid-typeof": [
505
- "error",
506
- {
507
- "requireStringLiterals": true
508
- }
509
- ],
510
- "wrap-iife": [
511
- "error",
512
- "any",
513
- {
514
- "functionPrototypeMethods": true
515
- }
516
- ],
517
- "yield-star-spacing": [
518
- "error",
519
- "both"
520
- ],
521
- "yoda": [
522
- "error",
523
- "never"
524
- ]
525
- }
526
- }
package/eslint.config.mjs DELETED
@@ -1,12 +0,0 @@
1
- import globals from "globals";
2
- import pluginJs from "@eslint/js";
3
- import tseslint from "typescript-eslint";
4
-
5
-
6
- /** @type {import('eslint').Linter.Config[]} */
7
- export default [
8
- {files: ["**/*.{js,mjs,cjs,ts}"]},
9
- {languageOptions: { globals: globals.browser }},
10
- pluginJs.configs.recommended,
11
- ...tseslint.configs.recommended,
12
- ];