bem / bem/bem-sdk

NamingConvention and defaultLayer

Open
#304 0 comments 1 reaction 0 assignees View on GitHub
prio:normal status:evaluating type:feature
Dominant language
JavaScript
Stars
89
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Knowledge of defaultLayer should not be a part of "naming.cell.match" package.
Can we write some sort of convention normalizer?

Feels like it can be a container with normalization functions like `Cell`, `EntityName`, etc.

This container should check and resolve fields for `naming`, `fs` delims, and anything else we use in naming presets:
- [ ] fsDelims:
```js
const dElem = 'elem' in dd ? dd.elem : (delims.elem || '__');
const dMod = 'mod' in dd ? dd.mod : (Object(delims.mod).name || (typeof delims.mod ===
'string' && delims.mod) || '_');
```
- [ ] asserts:
```js
assert(conv.fs && typeof conv.fs.pattern === 'string',
```
- [ ] knowledge about defaultLayer and `common` (?)
```js
const layer = conv.fs.defaultLayer || 'common';
```
```js
pathStringify({
layer: cell.layer || 'common',
tech: cell.tech,
entity: schemeStringify(cell.entity) + entityStringify(cell.entity)
}));
```
- [ ] defaults in `cell.match`:
```js
const buildPathParseMethod = ({ fs: { pattern, delims: dd = {}, scheme = 'nested' }, delims, wordPattern: wp = ALPHANUM_RE }) => {
```
- [ ] Pull in path parsers and builders for schemes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.