@storm-software/eslint 0.34.0 → 0.35.0
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/dist/preset.mjs +173 -135
- package/package.json +1 -1
package/dist/preset.mjs
CHANGED
|
@@ -12589,23 +12589,27 @@ const plugin = {
|
|
|
12589
12589
|
},
|
|
12590
12590
|
processors: {}
|
|
12591
12591
|
};
|
|
12592
|
-
plugin.configs.recommended =
|
|
12593
|
-
plugins: { banner: plugin },
|
|
12594
|
-
|
|
12595
|
-
"
|
|
12596
|
-
|
|
12597
|
-
|
|
12598
|
-
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
|
|
12605
|
-
|
|
12592
|
+
plugin.configs.recommended = [
|
|
12593
|
+
{ name: "banner/recommended/plugin", plugins: { banner: plugin } },
|
|
12594
|
+
{
|
|
12595
|
+
name: "banner/recommended/code-files",
|
|
12596
|
+
files: [
|
|
12597
|
+
"**/*.{,c,m}{j,t}s{,x}",
|
|
12598
|
+
"!tools/**/*",
|
|
12599
|
+
"!docs/**/*",
|
|
12600
|
+
"!crates/**/*",
|
|
12601
|
+
"!.*/**/*"
|
|
12602
|
+
],
|
|
12603
|
+
rules: {
|
|
12604
|
+
"banner/banner": [
|
|
12605
|
+
"error",
|
|
12606
|
+
{ banner: getFileBanner(""), commentType: "block", numNewlines: 2 }
|
|
12607
|
+
]
|
|
12608
|
+
}
|
|
12606
12609
|
}
|
|
12607
|
-
|
|
12610
|
+
];
|
|
12608
12611
|
|
|
12612
|
+
const CODE_BLOCK = "**/*.md{,x}/*";
|
|
12609
12613
|
const CODE_FILE = "**/*.{,c,m}{j,t}s{,x}";
|
|
12610
12614
|
const TS_FILE = "**/*.{,c,m}ts{,x}";
|
|
12611
12615
|
|
|
@@ -12616,7 +12620,7 @@ const formatConfig = (name, config = []) => {
|
|
|
12616
12620
|
}
|
|
12617
12621
|
return {
|
|
12618
12622
|
...config2,
|
|
12619
|
-
name: `Storm Software (${name}) #${index + 1}`,
|
|
12623
|
+
name: `Storm Software (${config2.name ? config2.name : name}) #${index + 1}`,
|
|
12620
12624
|
settings: {
|
|
12621
12625
|
"import/resolver": "node",
|
|
12622
12626
|
...config2.settings ?? {}
|
|
@@ -12625,6 +12629,56 @@ const formatConfig = (name, config = []) => {
|
|
|
12625
12629
|
});
|
|
12626
12630
|
};
|
|
12627
12631
|
|
|
12632
|
+
const DEFAULT_TYPESCRIPT_RULES = {
|
|
12633
|
+
"unicorn/number-literal-case": 0,
|
|
12634
|
+
"unicorn/template-indent": 0,
|
|
12635
|
+
"unicorn/prevent-abbreviations": 0,
|
|
12636
|
+
"unicorn/no-await-expression-member": 0,
|
|
12637
|
+
"unicorn/no-useless-undefined": 0,
|
|
12638
|
+
"unicorn/no-array-push-push": 0,
|
|
12639
|
+
"unicorn/no-array-reduce": 0,
|
|
12640
|
+
"unicorn/no-useless-switch-case": 0,
|
|
12641
|
+
"@typescript-eslint/no-explicit-any": 0,
|
|
12642
|
+
"@typescript-eslint/no-empty-function": 0,
|
|
12643
|
+
"@typescript-eslint/no-var-requires": 0,
|
|
12644
|
+
"@typescript-eslint/ban-ts-comment": 0,
|
|
12645
|
+
"@typescript-eslint/no-empty-interface": 0,
|
|
12646
|
+
"@typescript-eslint/explicit-module-boundary-types": 0,
|
|
12647
|
+
"@typescript-eslint/explicit-function-return-type": 0,
|
|
12648
|
+
"@typescript-eslint/no-unused-vars": [
|
|
12649
|
+
"warn",
|
|
12650
|
+
{ varsIgnorePattern: "^_", argsIgnorePattern: "^_" }
|
|
12651
|
+
],
|
|
12652
|
+
"unicorn/prefer-string-replace-all": 0,
|
|
12653
|
+
"unicorn/no-abusive-eslint-disable": 0,
|
|
12654
|
+
"unicorn/import-style": 0,
|
|
12655
|
+
"unicorn/prefer-module": 0,
|
|
12656
|
+
"unicorn/consistent-function-scoping": 0,
|
|
12657
|
+
"class-methods-use-this": 0,
|
|
12658
|
+
"@typescript-eslint/no-restricted-imports": [
|
|
12659
|
+
"error",
|
|
12660
|
+
{
|
|
12661
|
+
"patterns": [
|
|
12662
|
+
{
|
|
12663
|
+
"group": ["nx/src/plugins/js*"],
|
|
12664
|
+
"message": "Imports from 'nx/src/plugins/js' are not allowed. Use '@nx/js' instead"
|
|
12665
|
+
},
|
|
12666
|
+
{
|
|
12667
|
+
"group": ["**/native-bindings", "**/native-bindings.js"],
|
|
12668
|
+
"message": "Direct imports from native-bindings.js are not allowed. Import from index.js instead."
|
|
12669
|
+
},
|
|
12670
|
+
{
|
|
12671
|
+
"group": ["create-storm-workspace"],
|
|
12672
|
+
"message": "Direct imports from `create-storm-workspace` are not allowed. Instead install this package globally (example: 'npm i create-storm-workspace -g')."
|
|
12673
|
+
},
|
|
12674
|
+
{
|
|
12675
|
+
"group": ["create-nx-workspace"],
|
|
12676
|
+
"message": "Direct imports from `create-nx-workspace` are not allowed. Instead install this package globally (example: 'npm i create-nx-workspace -g')."
|
|
12677
|
+
}
|
|
12678
|
+
]
|
|
12679
|
+
}
|
|
12680
|
+
]
|
|
12681
|
+
};
|
|
12628
12682
|
function stormPreset(options = {
|
|
12629
12683
|
moduleBoundaries: {
|
|
12630
12684
|
enforceBuildableLibDependency: true,
|
|
@@ -12637,92 +12691,20 @@ function stormPreset(options = {
|
|
|
12637
12691
|
]
|
|
12638
12692
|
}
|
|
12639
12693
|
}, ...userConfigs) {
|
|
12640
|
-
const rules = {
|
|
12641
|
-
"unicorn/number-literal-case": 0,
|
|
12642
|
-
"unicorn/template-indent": 0,
|
|
12643
|
-
"unicorn/prevent-abbreviations": 0,
|
|
12644
|
-
"unicorn/no-await-expression-member": 0,
|
|
12645
|
-
"unicorn/no-useless-undefined": 0,
|
|
12646
|
-
"unicorn/no-array-push-push": 0,
|
|
12647
|
-
"unicorn/no-array-reduce": 0,
|
|
12648
|
-
"unicorn/no-useless-switch-case": 0,
|
|
12649
|
-
"@typescript-eslint/no-explicit-any": 0,
|
|
12650
|
-
"@typescript-eslint/no-empty-function": 0,
|
|
12651
|
-
"@typescript-eslint/no-var-requires": 0,
|
|
12652
|
-
"@typescript-eslint/ban-ts-comment": 0,
|
|
12653
|
-
"@typescript-eslint/no-empty-interface": 0,
|
|
12654
|
-
"@typescript-eslint/explicit-module-boundary-types": 0,
|
|
12655
|
-
"@typescript-eslint/explicit-function-return-type": 0,
|
|
12656
|
-
"@typescript-eslint/no-unused-vars": [
|
|
12657
|
-
"warn",
|
|
12658
|
-
{ varsIgnorePattern: "^_", argsIgnorePattern: "^_" }
|
|
12659
|
-
],
|
|
12660
|
-
"unicorn/prefer-string-replace-all": 0,
|
|
12661
|
-
"unicorn/no-abusive-eslint-disable": 0,
|
|
12662
|
-
"unicorn/import-style": 0,
|
|
12663
|
-
"unicorn/prefer-module": 0,
|
|
12664
|
-
"unicorn/consistent-function-scoping": 0,
|
|
12665
|
-
"class-methods-use-this": 0,
|
|
12666
|
-
...options.rules
|
|
12667
|
-
};
|
|
12668
12694
|
const configs = [
|
|
12669
12695
|
// https://eslint.org/docs/latest/rules/
|
|
12670
12696
|
eslint.configs.recommended,
|
|
12671
12697
|
// https://typescript-eslint.io/
|
|
12672
|
-
...tsEslint$1.configs.
|
|
12698
|
+
...tsEslint$1.configs.stylisticTypeChecked,
|
|
12673
12699
|
// https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
12674
12700
|
eslintPluginUnicorn.configs["flat/recommended"],
|
|
12675
12701
|
// Prettier
|
|
12676
12702
|
prettierConfig,
|
|
12677
|
-
// Preset overrides
|
|
12678
|
-
{ rules },
|
|
12679
|
-
{
|
|
12680
|
-
languageOptions: {
|
|
12681
|
-
globals: Object.fromEntries(
|
|
12682
|
-
Object.keys(globals).flatMap(
|
|
12683
|
-
(group) => Object.keys(globals[group]).map((k) => [
|
|
12684
|
-
k,
|
|
12685
|
-
true
|
|
12686
|
-
])
|
|
12687
|
-
)
|
|
12688
|
-
)
|
|
12689
|
-
}
|
|
12690
|
-
},
|
|
12691
|
-
{ ignores: ["dist", "coverage", ...options.ignores || []] },
|
|
12692
|
-
// Markdown
|
|
12693
|
-
// https://www.npmjs.com/package/eslint-plugin-markdown
|
|
12694
|
-
options.markdown !== false && { plugins: { markdown } },
|
|
12695
|
-
options.markdown !== false && {
|
|
12696
|
-
files: [CODE_FILE],
|
|
12697
|
-
processor: "markdown/markdown"
|
|
12698
|
-
},
|
|
12699
|
-
options.markdown !== false && {
|
|
12700
|
-
files: ["**/*.md/*.js", "**/*.md/*.ts"],
|
|
12701
|
-
rules: {
|
|
12702
|
-
"unicorn/filename-case": 0,
|
|
12703
|
-
"no-undef": 0,
|
|
12704
|
-
"no-unused-expressions": 0,
|
|
12705
|
-
"padded-blocks": 0,
|
|
12706
|
-
"no-empty-pattern": 0,
|
|
12707
|
-
"no-redeclare": 0,
|
|
12708
|
-
"no-import-assign": 0,
|
|
12709
|
-
...options.markdown?.rules
|
|
12710
|
-
}
|
|
12711
|
-
},
|
|
12712
12703
|
// React
|
|
12713
12704
|
// https://www.npmjs.com/package/eslint-plugin-react
|
|
12714
12705
|
options.react !== false && {
|
|
12715
12706
|
plugins: { react, "react-hooks": reactHooks, "jsx-a11y": jsxA11y }
|
|
12716
12707
|
},
|
|
12717
|
-
options.react !== false && {
|
|
12718
|
-
files: [CODE_FILE],
|
|
12719
|
-
rules: {
|
|
12720
|
-
...config$2,
|
|
12721
|
-
...config$1,
|
|
12722
|
-
...config$3,
|
|
12723
|
-
...options.react?.rules
|
|
12724
|
-
}
|
|
12725
|
-
},
|
|
12726
12708
|
// Import
|
|
12727
12709
|
// https://www.npmjs.com/package/eslint-plugin-import
|
|
12728
12710
|
// { plugins: { import: importEslint } },
|
|
@@ -12731,7 +12713,7 @@ function stormPreset(options = {
|
|
|
12731
12713
|
// rules: importRules
|
|
12732
12714
|
// },
|
|
12733
12715
|
// Banner
|
|
12734
|
-
plugin.configs["recommended"],
|
|
12716
|
+
plugin.configs["recommended"][0],
|
|
12735
12717
|
// TSDoc
|
|
12736
12718
|
// https://www.npmjs.com/package/eslint-plugin-tsdoc
|
|
12737
12719
|
{ plugins: { tsdoc } },
|
|
@@ -12739,51 +12721,9 @@ function stormPreset(options = {
|
|
|
12739
12721
|
files: [TS_FILE],
|
|
12740
12722
|
rules: config
|
|
12741
12723
|
},
|
|
12742
|
-
//
|
|
12724
|
+
// NX
|
|
12743
12725
|
{
|
|
12744
|
-
plugins: { "@nx": nxPlugin }
|
|
12745
|
-
languageOptions: {
|
|
12746
|
-
parser: tsEslint$1.parser,
|
|
12747
|
-
globals: {
|
|
12748
|
-
...globals.node,
|
|
12749
|
-
...globals.browser,
|
|
12750
|
-
"StormProvider": true
|
|
12751
|
-
}
|
|
12752
|
-
},
|
|
12753
|
-
files: [CODE_FILE],
|
|
12754
|
-
rules: {
|
|
12755
|
-
"@nx/enforce-module-boundaries": [
|
|
12756
|
-
"error",
|
|
12757
|
-
options.moduleBoundaries ? options.moduleBoundaries : {
|
|
12758
|
-
enforceBuildableLibDependency: true,
|
|
12759
|
-
checkDynamicDependenciesExceptions: [".*"],
|
|
12760
|
-
allow: [],
|
|
12761
|
-
depConstraints: [
|
|
12762
|
-
{
|
|
12763
|
-
sourceTag: "*",
|
|
12764
|
-
onlyDependOnLibsWithTags: ["*"]
|
|
12765
|
-
}
|
|
12766
|
-
]
|
|
12767
|
-
}
|
|
12768
|
-
],
|
|
12769
|
-
"no-restricted-imports": ["error", "create-nx-workspace"],
|
|
12770
|
-
"@typescript-eslint/no-restricted-imports": [
|
|
12771
|
-
"error",
|
|
12772
|
-
{
|
|
12773
|
-
"patterns": [
|
|
12774
|
-
{
|
|
12775
|
-
"group": ["nx/src/plugins/js*"],
|
|
12776
|
-
"message": "Imports from 'nx/src/plugins/js' are not allowed. Use '@nx/js' instead"
|
|
12777
|
-
},
|
|
12778
|
-
{
|
|
12779
|
-
"group": ["**/native-bindings", "**/native-bindings.js", ""],
|
|
12780
|
-
"message": "Direct imports from native-bindings.js are not allowed. Import from index.js instead."
|
|
12781
|
-
}
|
|
12782
|
-
]
|
|
12783
|
-
}
|
|
12784
|
-
],
|
|
12785
|
-
"unicorn/prefer-logical-operator-over-ternary": "warn"
|
|
12786
|
-
}
|
|
12726
|
+
plugins: { "@nx": nxPlugin }
|
|
12787
12727
|
},
|
|
12788
12728
|
// Json
|
|
12789
12729
|
// https://www.npmjs.com/package/eslint-plugin-json
|
|
@@ -12825,7 +12765,105 @@ function stormPreset(options = {
|
|
|
12825
12765
|
// User overrides
|
|
12826
12766
|
...userConfigs
|
|
12827
12767
|
].filter(Boolean);
|
|
12768
|
+
const typescriptConfig = {
|
|
12769
|
+
...tsEslint$1.configs.stylisticTypeChecked,
|
|
12770
|
+
...eslintPluginUnicorn.configs["flat/recommended"],
|
|
12771
|
+
files: [CODE_FILE],
|
|
12772
|
+
languageOptions: {
|
|
12773
|
+
parser: tsEslint$1.parser,
|
|
12774
|
+
globals: {
|
|
12775
|
+
...Object.fromEntries(
|
|
12776
|
+
Object.keys(globals).flatMap(
|
|
12777
|
+
(group) => Object.keys(globals[group]).map((k) => [
|
|
12778
|
+
k,
|
|
12779
|
+
true
|
|
12780
|
+
])
|
|
12781
|
+
)
|
|
12782
|
+
),
|
|
12783
|
+
"StormProvider": true
|
|
12784
|
+
}
|
|
12785
|
+
},
|
|
12786
|
+
rules: {
|
|
12787
|
+
// https://eslint.org/docs/latest/rules/
|
|
12788
|
+
...eslint.configs.recommended.rules,
|
|
12789
|
+
// https://typescript-eslint.io/
|
|
12790
|
+
...tsEslint$1.configs.stylisticTypeChecked.reduce(
|
|
12791
|
+
(ret, record) => ({ ...ret, ...record.rules }),
|
|
12792
|
+
{}
|
|
12793
|
+
),
|
|
12794
|
+
// Prettier
|
|
12795
|
+
...prettierConfig.rules,
|
|
12796
|
+
// https://www.npmjs.com/package/eslint-plugin-unicorn
|
|
12797
|
+
...eslintPluginUnicorn.configs["flat/recommended"].rules,
|
|
12798
|
+
// Banner
|
|
12799
|
+
...plugin.configs["recommended"][1].rules,
|
|
12800
|
+
// NX
|
|
12801
|
+
"@nx/enforce-module-boundaries": [
|
|
12802
|
+
"error",
|
|
12803
|
+
options.moduleBoundaries ? options.moduleBoundaries : {
|
|
12804
|
+
enforceBuildableLibDependency: true,
|
|
12805
|
+
checkDynamicDependenciesExceptions: [".*"],
|
|
12806
|
+
allow: [],
|
|
12807
|
+
depConstraints: [
|
|
12808
|
+
{
|
|
12809
|
+
sourceTag: "*",
|
|
12810
|
+
onlyDependOnLibsWithTags: ["*"]
|
|
12811
|
+
}
|
|
12812
|
+
]
|
|
12813
|
+
}
|
|
12814
|
+
],
|
|
12815
|
+
...DEFAULT_TYPESCRIPT_RULES,
|
|
12816
|
+
...options.typescript ?? {}
|
|
12817
|
+
},
|
|
12818
|
+
ignores: ["dist", "coverage", "tmp", ...options.ignores || []]
|
|
12819
|
+
};
|
|
12820
|
+
if (options.react !== false) {
|
|
12821
|
+
typescriptConfig.rules = {
|
|
12822
|
+
...typescriptConfig.rules,
|
|
12823
|
+
// React
|
|
12824
|
+
...config$2,
|
|
12825
|
+
...config$1,
|
|
12826
|
+
...config$3
|
|
12827
|
+
};
|
|
12828
|
+
if (options.react?.rules) {
|
|
12829
|
+
typescriptConfig.rules = {
|
|
12830
|
+
...typescriptConfig.rules,
|
|
12831
|
+
...options.react.rules
|
|
12832
|
+
};
|
|
12833
|
+
}
|
|
12834
|
+
}
|
|
12835
|
+
configs.push(typescriptConfig);
|
|
12836
|
+
if (options.markdown !== false) {
|
|
12837
|
+
configs.push(...markdown.configs.recommended);
|
|
12838
|
+
configs.push({
|
|
12839
|
+
files: [CODE_BLOCK],
|
|
12840
|
+
processor: "markdown/markdown",
|
|
12841
|
+
rules: {
|
|
12842
|
+
"unicorn/filename-case": 0,
|
|
12843
|
+
"no-undef": 0,
|
|
12844
|
+
"no-unused-expressions": 0,
|
|
12845
|
+
"padded-blocks": 0,
|
|
12846
|
+
"no-empty-pattern": 0,
|
|
12847
|
+
"no-redeclare": 0,
|
|
12848
|
+
"no-import-assign": 0,
|
|
12849
|
+
...options.markdown?.rules
|
|
12850
|
+
}
|
|
12851
|
+
});
|
|
12852
|
+
configs.push({
|
|
12853
|
+
files: ["**/*.md/*.js", "**/*.md/*.ts"],
|
|
12854
|
+
rules: {
|
|
12855
|
+
"unicorn/filename-case": 0,
|
|
12856
|
+
"no-undef": 0,
|
|
12857
|
+
"no-unused-expressions": 0,
|
|
12858
|
+
"padded-blocks": 0,
|
|
12859
|
+
"no-empty-pattern": 0,
|
|
12860
|
+
"no-redeclare": 0,
|
|
12861
|
+
"no-import-assign": 0,
|
|
12862
|
+
...options.markdown?.rules
|
|
12863
|
+
}
|
|
12864
|
+
});
|
|
12865
|
+
}
|
|
12828
12866
|
return formatConfig("Preset", configs);
|
|
12829
12867
|
}
|
|
12830
12868
|
|
|
12831
|
-
export { stormPreset as default };
|
|
12869
|
+
export { DEFAULT_TYPESCRIPT_RULES, stormPreset as default };
|
package/package.json
CHANGED