@rdjperron/lint 0.1.0 → 0.2.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/README.md +146 -57
- package/dist/config.d.mts +113 -0
- package/dist/config.mjs +218 -0
- package/dist/config.mjs.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/{anti-slop.mjs → index.mjs} +253 -94
- package/dist/index.mjs.map +1 -0
- package/dist/verify.d.mts +92 -0
- package/dist/verify.mjs +400 -0
- package/dist/verify.mjs.map +1 -0
- package/docs/rules/README.md +43 -0
- package/docs/rules/no-array-filter-map.md +60 -0
- package/docs/rules/no-chained-type-assertions.md +52 -0
- package/docs/rules/no-conditional-empty-object-spread.md +50 -0
- package/docs/rules/no-hardcoded-jsx-text.md +52 -0
- package/docs/rules/no-known-value-widening.md +62 -0
- package/docs/rules/no-module-mocking.md +53 -0
- package/docs/rules/no-object-parameters.md +55 -0
- package/docs/rules/no-reduce-accumulator-copy.md +57 -0
- package/docs/rules/no-reflect-apply.md +56 -0
- package/docs/rules/no-reflect-get.md +51 -0
- package/docs/rules/no-runtime-typeof.md +61 -0
- package/docs/rules/no-shape-in-symbol-names.md +53 -0
- package/docs/rules/no-unknown-parameters.md +55 -0
- package/docs/rules/no-unknown-returns.md +61 -0
- package/docs/rules/no-unknown-type-aliases.md +52 -0
- package/docs/rules/no-unsafe-dictionary-type.md +56 -0
- package/docs/rules/no-use-effect.md +55 -0
- package/docs/rules/no-widen-then-assert.md +53 -0
- package/docs/rules/require-safety-comment-for-type-assertion.md +59 -0
- package/docs/rules/static-public-env.md +55 -0
- package/fixtures/README.md +22 -23
- package/fixtures/{anti-slop/no-array-filter-map.fixture.ts → no-array-filter-map.fixture.ts} +1 -1
- package/fixtures/{anti-slop/no-chained-type-assertions.fixture.ts → no-chained-type-assertions.fixture.ts} +1 -1
- package/fixtures/{anti-slop/no-conditional-empty-object-spread.fixture.ts → no-conditional-empty-object-spread.fixture.ts} +1 -1
- package/fixtures/{i18n/no-hardcoded-jsx-text.fixture.tsx → no-hardcoded-jsx-text.fixture.tsx} +1 -1
- package/fixtures/{anti-slop/no-known-value-widening.fixture.ts → no-known-value-widening.fixture.ts} +1 -1
- package/fixtures/{anti-slop/no-module-mocking.fixture.ts → no-module-mocking.fixture.ts} +1 -1
- package/fixtures/{anti-slop/no-object-parameters.fixture.ts → no-object-parameters.fixture.ts} +1 -1
- package/fixtures/{anti-slop/no-reduce-accumulator-copy.fixture.ts → no-reduce-accumulator-copy.fixture.ts} +1 -1
- package/fixtures/{anti-slop/no-reflect-apply.fixture.ts → no-reflect-apply.fixture.ts} +1 -1
- package/fixtures/{anti-slop/no-reflect-get.fixture.ts → no-reflect-get.fixture.ts} +1 -1
- package/fixtures/{anti-slop/no-runtime-typeof.fixture.ts → no-runtime-typeof.fixture.ts} +1 -1
- package/fixtures/no-shape-in-symbol-names.fixture.ts +2 -0
- package/fixtures/{anti-slop/no-unknown-parameters.fixture.ts → no-unknown-parameters.fixture.ts} +1 -1
- package/fixtures/{anti-slop/no-unknown-returns.fixture.ts → no-unknown-returns.fixture.ts} +1 -1
- package/fixtures/no-unknown-type-aliases.fixture.ts +2 -0
- package/fixtures/no-unsafe-dictionary-type.fixture.ts +2 -0
- package/fixtures/{react/no-use-effect.fixture.tsx → no-use-effect.fixture.tsx} +1 -1
- package/fixtures/{anti-slop/no-widen-then-assert.fixture.ts → no-widen-then-assert.fixture.ts} +1 -1
- package/fixtures/{anti-slop/require-safety-comment-for-type-assertion.fixture.ts → require-safety-comment-for-type-assertion.fixture.ts} +1 -1
- package/fixtures/{expo/static-public-env.fixture.ts → static-public-env.fixture.ts} +1 -1
- package/package.json +27 -26
- package/dist/anti-slop.d.mts +0 -6
- package/dist/anti-slop.mjs.map +0 -1
- package/dist/expo.d.mts +0 -5
- package/dist/expo.mjs +0 -51
- package/dist/expo.mjs.map +0 -1
- package/dist/i18n.d.mts +0 -5
- package/dist/i18n.mjs +0 -50
- package/dist/i18n.mjs.map +0 -1
- package/dist/react.d.mts +0 -5
- package/dist/react.mjs +0 -73
- package/dist/react.mjs.map +0 -1
- package/dist/rule-options-DrAXz8BD.mjs +0 -18
- package/dist/rule-options-DrAXz8BD.mjs.map +0 -1
- package/fixtures/anti-slop/no-shape-in-symbol-names.fixture.ts +0 -2
- package/fixtures/anti-slop/no-unknown-type-aliases.fixture.ts +0 -2
- package/fixtures/anti-slop/no-unsafe-dictionary-type.fixture.ts +0 -2
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region src/shared/rule-options.ts
|
|
2
|
-
/**
|
|
3
|
-
* Rule options arrive as parsed JSON from the linter config, so this is the one
|
|
4
|
-
* place their shape is checked. Returns the first option when it is an object.
|
|
5
|
-
*/
|
|
6
|
-
function firstOptionObject(options) {
|
|
7
|
-
const first = options[0];
|
|
8
|
-
return typeof first === "object" && first !== null && !Array.isArray(first) ? first : {};
|
|
9
|
-
}
|
|
10
|
-
/** A string-valued key of the first option object, or undefined when absent or not a string. */
|
|
11
|
-
function stringOption(options, key) {
|
|
12
|
-
const value = firstOptionObject(options)[key];
|
|
13
|
-
return typeof value === "string" ? value : void 0;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { stringOption as t };
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=rule-options-DrAXz8BD.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rule-options-DrAXz8BD.mjs","names":[],"sources":["../src/shared/rule-options.ts"],"sourcesContent":["import type { Options } from \"@oxlint/plugins\";\n\ntype OptionValue = Options[number];\n\n/**\n * Rule options arrive as parsed JSON from the linter config, so this is the one\n * place their shape is checked. Returns the first option when it is an object.\n */\nfunction firstOptionObject(options: Readonly<Options>): { readonly [key: string]: OptionValue } {\n const first = options[0];\n return typeof first === \"object\" && first !== null && !Array.isArray(first) ? first : {};\n}\n\n/** A string-valued key of the first option object, or undefined when absent or not a string. */\nexport function stringOption(options: Readonly<Options>, key: string): string | undefined {\n const value = firstOptionObject(options)[key];\n return typeof value === \"string\" ? value : undefined;\n}\n"],"mappings":";;;;;AAQA,SAAS,kBAAkB,SAAqE;CAC9F,MAAM,QAAQ,QAAQ;CACtB,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC;AACzF;;AAGA,SAAgB,aAAa,SAA4B,KAAiC;CACxF,MAAM,QAAQ,kBAAkB,OAAO,CAAC,CAAC;CACzC,OAAO,OAAO,UAAU,WAAW,QAAQ,KAAA;AAC7C"}
|