@drupal-canvas/eslint-config 0.1.1 → 0.1.2
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.
- package/README.md +2 -2
- package/dist/index.js +48 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ npm install -D @drupal-canvas/eslint-config
|
|
|
18
18
|
|
|
19
19
|
```js
|
|
20
20
|
// eslint.config.js
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
21
|
+
import { defineConfig } from 'eslint/config';
|
|
22
|
+
import { recommended as drupalCanvasRecommended } from '@drupal-canvas/eslint-config';
|
|
23
23
|
|
|
24
24
|
export default defineConfig([
|
|
25
25
|
...drupalCanvasRecommended,
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
2
|
-
import react from 'eslint-plugin-react';
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks';
|
|
4
1
|
import eslintPluginYml from 'eslint-plugin-yml';
|
|
5
2
|
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
6
|
-
import js from '@eslint/js';
|
|
7
3
|
import globals from 'globals';
|
|
8
4
|
import { dirname, basename } from 'path';
|
|
9
5
|
import { existsSync, readdirSync } from 'fs';
|
|
10
6
|
import { camelCase } from 'lodash-es';
|
|
7
|
+
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
8
|
+
import react from 'eslint-plugin-react';
|
|
9
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
10
|
+
import js from '@eslint/js';
|
|
11
11
|
|
|
12
|
-
// src/configs/
|
|
12
|
+
// src/configs/next.ts
|
|
13
13
|
function isInComponentDir(context) {
|
|
14
14
|
try {
|
|
15
15
|
const componentDir = dirname(context.filename);
|
|
@@ -60,7 +60,6 @@ var rule = {
|
|
|
60
60
|
}
|
|
61
61
|
let hasMachineName = false;
|
|
62
62
|
return {
|
|
63
|
-
// @ts-expect-error - YAMLPair is a valid listener from eslint-plugin-yml
|
|
64
63
|
YAMLPair(node) {
|
|
65
64
|
const keyName = getYAMLStringValue(node.key);
|
|
66
65
|
if (keyName !== "machineName") {
|
|
@@ -436,7 +435,6 @@ var rule6 = {
|
|
|
436
435
|
return {};
|
|
437
436
|
}
|
|
438
437
|
return {
|
|
439
|
-
// @ts-expect-error - YAMLPair is a valid listener from eslint-plugin-yml
|
|
440
438
|
YAMLPair(node) {
|
|
441
439
|
const keyName = getYAMLStringValue(node.key);
|
|
442
440
|
if (keyName !== "props") {
|
|
@@ -468,8 +466,48 @@ var rule6 = {
|
|
|
468
466
|
};
|
|
469
467
|
var component_prop_names_default = rule6;
|
|
470
468
|
|
|
471
|
-
// src/configs/
|
|
469
|
+
// src/configs/next.ts
|
|
472
470
|
var required = defineConfig([
|
|
471
|
+
globalIgnores(["**/dist/**"]),
|
|
472
|
+
{
|
|
473
|
+
files: ["**/*.{js,jsx}"],
|
|
474
|
+
languageOptions: {
|
|
475
|
+
ecmaVersion: 2020,
|
|
476
|
+
globals: globals.browser,
|
|
477
|
+
parserOptions: {
|
|
478
|
+
ecmaVersion: "latest",
|
|
479
|
+
ecmaFeatures: { jsx: true },
|
|
480
|
+
sourceType: "module"
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
settings: { react: { version: "19.0" } }
|
|
484
|
+
},
|
|
485
|
+
eslintPluginYml.configs["flat/base"],
|
|
486
|
+
{
|
|
487
|
+
plugins: {
|
|
488
|
+
"drupal-canvas": {
|
|
489
|
+
rules: {
|
|
490
|
+
"component-dir-name": component_dir_name_default,
|
|
491
|
+
"component-exports": component_exports_default,
|
|
492
|
+
"component-files": component_files_default,
|
|
493
|
+
"component-imports": component_imports_default,
|
|
494
|
+
"component-no-hierarchy": component_no_hierarchy_default,
|
|
495
|
+
"component-prop-names": component_prop_names_default
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
rules: {
|
|
500
|
+
"drupal-canvas/component-dir-name": "error",
|
|
501
|
+
// 'drupal-canvas/component-exports': 'error',
|
|
502
|
+
// 'drupal-canvas/component-files': 'error',
|
|
503
|
+
// 'drupal-canvas/component-imports': 'error',
|
|
504
|
+
// 'drupal-canvas/component-no-hierarchy': 'error',
|
|
505
|
+
"drupal-canvas/component-prop-names": "error"
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
]);
|
|
509
|
+
var next_default = required;
|
|
510
|
+
var required2 = defineConfig([
|
|
473
511
|
globalIgnores(["**/dist/**"]),
|
|
474
512
|
{
|
|
475
513
|
files: ["**/*.{js,jsx}"],
|
|
@@ -508,7 +546,7 @@ var required = defineConfig([
|
|
|
508
546
|
}
|
|
509
547
|
}
|
|
510
548
|
]);
|
|
511
|
-
var required_default =
|
|
549
|
+
var required_default = required2;
|
|
512
550
|
|
|
513
551
|
// src/configs/recommended.ts
|
|
514
552
|
var recommended = defineConfig([
|
|
@@ -551,4 +589,4 @@ var strict = defineConfig([
|
|
|
551
589
|
]);
|
|
552
590
|
var strict_default = strict;
|
|
553
591
|
|
|
554
|
-
export { recommended_default as recommended, required_default as required, strict_default as strict };
|
|
592
|
+
export { next_default as next, recommended_default as recommended, required_default as required, strict_default as strict };
|