-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
3,957 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
insert_final_newline = false | ||
trim_trailing_whitespace = false | ||
|
||
[*.{js,jsx,json,ts,tsx,yml}] | ||
indent_size = 2 | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
es6: true, | ||
node: true, | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:jest/recommended', | ||
'prettier', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 12, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint', 'jest'], | ||
rules: { | ||
'no-console': 'error', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: 'yarn' | ||
directory: '/' | ||
schedule: | ||
interval: 'daily' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,5 @@ pnpm-debug.log* | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
# shellcheck source=./_/husky.sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
command_exists () { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
|
||
# Workaround for Windows 10, Git Bash and Yarn | ||
if command_exists winpty && test -t 1; then | ||
exec < /dev/tty | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'], | ||
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --write--parser json'], | ||
'package.json': ['prettier --write'], | ||
'*.md': ['prettier --write'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
. "$(dirname "$0")/common.sh" | ||
|
||
[ -n "$CI" ] && exit 0 | ||
|
||
# Format and submit code according to lintstagedrc.js configuration | ||
npm run lint:lint-staged | ||
|
||
npm run lint:pretty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist/ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/types/'], | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(ts|js)x?$', | ||
coverageDirectory: 'coverage', | ||
collectCoverageFrom: ['src/**/*.{ts,tsx,js,jsx}', '!src/**/*.d.ts'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,11 @@ module.exports = { | |
tabWidth: 2, | ||
}, | ||
}, | ||
{ | ||
files: '*.ts', | ||
options: { | ||
parser: 'typescript', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { createSymbolId } from '../src/index'; | ||
|
||
const TEST_SYMBOL_ID = 'icon-[dir]-[name]'; | ||
// const TEST_SYMBOL_ID = 'icon-[name]'; | ||
test('createSymbolId test', () => { | ||
const options = { symbolId: TEST_SYMBOL_ID } as any; | ||
|
||
const normalId = createSymbolId('file.svg', options); | ||
const dirId = createSymbolId('dir/file.svg', options); | ||
const folderId = createSymbolId('folder/dir/file.svg', options); | ||
const specialId = createSymbolId('folder/dir/.file.svg', options); | ||
|
||
expect(normalId).toBe('icon-file'); | ||
expect(dirId).toBe('icon-dir-file'); | ||
expect(folderId).toBe('icon-folder-dir-file'); | ||
expect(specialId).toBe('icon-folder-dir-.file'); | ||
}); | ||
|
||
test('createSymbolId Not dir', () => { | ||
const id = createSymbolId('dir/file.svg', { symbolId: 'icon-[name]' } as any); | ||
|
||
expect(id).toBe('icon-dir/file'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { discreteDir } from '../src/index'; | ||
test('discreteDir Not included /', () => { | ||
const { fileName, dirName } = discreteDir('file.svg'); | ||
|
||
expect(fileName).toBe('file.svg'); | ||
expect(dirName).toBe(''); | ||
}); | ||
|
||
test('discreteDir Not included / and include .', () => { | ||
const { fileName, dirName } = discreteDir('file.name.svg'); | ||
|
||
expect(fileName).toBe('file.name.svg'); | ||
expect(dirName).toBe(''); | ||
}); | ||
|
||
test('discreteDir Included /', () => { | ||
const { fileName, dirName } = discreteDir('dir/file.svg'); | ||
|
||
expect(fileName).toBe('file.svg'); | ||
expect(dirName).toBe('dir'); | ||
}); | ||
|
||
test('discreteDir Included multiple /', () => { | ||
const { fileName, dirName } = discreteDir('folder/dir/file.svg'); | ||
|
||
expect(fileName).toBe('file.svg'); | ||
expect(dirName).toBe('folder-dir'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.