Skip to content

Commit f618107

Browse files
authored
fix: add missing import locality rule (#216)
1 parent ce6785b commit f618107

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

.changeset/shiny-trees-live.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@feature-sliced/steiger-plugin': patch
3+
---
4+
5+
add import locality rule

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ Currently, Steiger is not extendable with more rules, though that will change in
124124
<tr> <td><a href="./packages/steiger-plugin-fsd/src/ambiguous-slice-names/README.md"><code>fsd/ambiguous-slice-names</code></a></td> <td>Forbid slice names that that match some segment’s name in the Shared layer.</td> </tr>
125125
<tr> <td><a href="./packages/steiger-plugin-fsd/src/excessive-slicing/README.md"><code>fsd/excessive-slicing</code></a></td> <td>Forbid having too many ungrouped slices or too many slices in a group.</td> </tr>
126126
<tr> <td><a href="./packages/steiger-plugin-fsd/src/forbidden-imports/README.md"><code>fsd/forbidden-imports</code></a></td> <td>Forbid imports from higher layers and cross-imports between slices on the same layer.</td> </tr>
127-
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-cross-imports/README.md"><code>fsd/no-cross-imports</code></a></td> <td>Forbid cross-imports between slices on the same layer.</td> </tr>
128-
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-higher-level-imports/README.md"><code>fsd/no-higher-level-imports</code></a></td> <td>Forbid imports from higher layers.</td> </tr>
127+
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-cross-imports/README.md"><code>fsd/no-cross-imports</code></a></td> <td>[disabled] Forbid cross-imports between slices on the same layer.</td> </tr>
128+
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-higher-level-imports/README.md"><code>fsd/no-higher-level-imports</code></a></td> <td>[disabled] Forbid imports from higher layers.</td> </tr>
129129
<tr> <td><a href="./packages/steiger-plugin-fsd/src/inconsistent-naming/README.md"><code>fsd/inconsistent-naming</code></a></td> <td>Ensure that all entities are named consistently in terms of pluralization.</td> </tr>
130130
<tr> <td><a href="./packages/steiger-plugin-fsd/src/insignificant-slice/README.md"><code>fsd/insignificant-slice</code></a></td> <td>Detect slices that have just one reference or no references to them at all.</td> </tr>
131131
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-layer-public-api/README.md"><code>fsd/no-layer-public-api</code></a></td> <td>Forbid index files on the layer level.</td> </tr>
@@ -140,6 +140,7 @@ Currently, Steiger is not extendable with more rules, though that will change in
140140
<tr> <td><a href="./packages/steiger-plugin-fsd/src/shared-lib-grouping/README.md"><code>fsd/shared-lib-grouping</code></a></td> <td>Forbid having too many ungrouped modules in <code>shared/lib</code>.</td> </tr>
141141
<tr> <td><a href="./packages/steiger-plugin-fsd/src/typo-in-layer-name/README.md"><code>fsd/typo-in-layer-name</code></a></td> <td>Ensure that all layers are named without any typos.</td> </tr>
142142
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-processes/README.md"><code>fsd/no-processes</code></a></td> <td>Discourage the use of the deprecated Processes layer.</td> </tr>
143+
<tr> <td><a href="./packages/steiger-plugin-fsd/src/import-locality/README.md"><code>fsd/import-locality</code></a></td> <td>[disabled] Require that imports from the same slice be relative and imports from one slice to another be absolute.</td> </tr>
143144
</tbody>
144145
</table>
145146

packages/steiger-plugin-fsd/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import noProcesses from './no-processes/index.js'
1919
import packageJson from '../package.json' with { type: 'json' }
2020
import noCrossImports from './no-cross-imports/index.js'
2121
import noHigherLevelImports from './no-higher-level-imports/index.js'
22+
import importLocality from './import-locality/index.js'
2223

2324
const enabledRules = [
2425
ambiguousSliceNames,
@@ -39,7 +40,7 @@ const enabledRules = [
3940
typoInLayerName,
4041
noProcesses,
4142
]
42-
const disabledRules = [noCrossImports, noHigherLevelImports]
43+
const disabledRules = [noCrossImports, noHigherLevelImports, importLocality]
4344

4445
const rules = [...enabledRules, ...disabledRules]
4546

packages/steiger/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ Currently, Steiger is not extendable with more rules, though that will change in
123123
<tr> <td><a href="./packages/steiger-plugin-fsd/src/ambiguous-slice-names/README.md"><code>ambiguous-slice-names</code></a></td> <td>Forbid slice names that that match some segment’s name in the Shared layer.</td> </tr>
124124
<tr> <td><a href="./packages/steiger-plugin-fsd/src/excessive-slicing/README.md"><code>excessive-slicing</code></a></td> <td>Forbid having too many ungrouped slices or too many slices in a group.</td> </tr>
125125
<tr> <td><a href="./packages/steiger-plugin-fsd/src/forbidden-imports/README.md"><code>forbidden-imports</code></a></td> <td>Forbid imports from higher layers and cross-imports between slices on the same layer.</td> </tr>
126+
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-cross-imports/README.md"><code>fsd/no-cross-imports</code></a></td> <td>[disabled] Forbid cross-imports between slices on the same layer.</td> </tr>
127+
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-higher-level-imports/README.md"><code>fsd/no-higher-level-imports</code></a></td> <td>[disabled] Forbid imports from higher layers.</td> </tr>
126128
<tr> <td><a href="./packages/steiger-plugin-fsd/src/inconsistent-naming/README.md"><code>inconsistent-naming</code></a></td> <td>Ensure that all entities are named consistently in terms of pluralization.</td> </tr>
127129
<tr> <td><a href="./packages/steiger-plugin-fsd/src/insignificant-slice/README.md"><code>insignificant-slice</code></a></td> <td>Detect slices that have just one reference or no references to them at all.</td> </tr>
128130
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-layer-public-api/README.md"><code>no-layer-public-api</code></a></td> <td>Forbid index files on the layer level.</td> </tr>
@@ -137,7 +139,7 @@ Currently, Steiger is not extendable with more rules, though that will change in
137139
<tr> <td><a href="./packages/steiger-plugin-fsd/src/shared-lib-grouping/README.md"><code>shared-lib-grouping</code></a></td> <td>Forbid having too many ungrouped modules in <code>shared/lib</code>.</td> </tr>
138140
<tr> <td><a href="./packages/steiger-plugin-fsd/src/typo-in-layer-name/README.md"><code>typo-in-layer-name</code></a></td> <td>Ensure that all layers are named without any typos.</td> </tr>
139141
<tr> <td><a href="./packages/steiger-plugin-fsd/src/no-processes/README.md"><code>no-processes</code></a></td> <td>Discourage the use of the deprecated Processes layer.</td> </tr>
140-
<tr> <td><a href="./packages/steiger-plugin-fsd/src/import-locality/README.md"><code>import-locality</code></a></td> <td>Require that imports from the same slice be relative and imports from one slice to another be absolute.</td> </tr>
142+
<tr> <td><a href="./packages/steiger-plugin-fsd/src/import-locality/README.md"><code>import-locality</code></a></td> <td>[disabled] Require that imports from the same slice be relative and imports from one slice to another be absolute.</td> </tr>
141143
</tbody>
142144
</table>
143145

0 commit comments

Comments
 (0)