Skip to content

Commit

Permalink
refactor: Start moving the code for better sharing. (#2561)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Mar 2, 2023
1 parent 5f12670 commit beddb1f
Show file tree
Hide file tree
Showing 132 changed files with 10,240 additions and 194 deletions.
13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const config = {
'packages/*/dist/**',
'packages/*/out/**',
'**/temp/**',
'**/dist/**',
'packages/client/settingsViewer/**',
],
plugins: ['import', 'unicorn', 'simple-import-sort'],
Expand Down Expand Up @@ -84,6 +85,18 @@ const config = {
'node/no-unsupported-features/es-syntax': 'off',
},
},
{
files: ['**/*.test.*', '**/__mocks__/**'],
rules: {
'node/no-extraneous-import': 'off',
},
},
{
files: ['**/jest.config.js'],
rules: {
'node/no-unpublished-require': 'off',
},
},
],
settings: {
'import/core-modules': ['vscode'],
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ node_modules
.vscode-test

/temp
modules/dist/
modules/*/dist/
packages/*/dist/
packages/*/out/
packages/*/temp/
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ packages/*/out/**
.yarn
packages/client/settingsViewer/
samples/php/**/vendor
tsconfig*.json
2 changes: 1 addition & 1 deletion Spell Checker.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}
],
"settings": {
"cSpell.import": ["${workspaceFolder:Spell Checker Root}/cSpell.json"],
"cSpell.import": ["${workspaceFolder:Spell Checker Root}/cspell.json"],
"cSpell.customDictionaries": { "cspell-words": true },
"typescript.tsdk": "Spell Checker Root/node_modules/typescript/lib",
"svg.preview.background": "black",
Expand Down
2 changes: 2 additions & 0 deletions cspell-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ issuehunt
Jupyter
KotlinScript
languageclient
lcov
lerna
liga
lightblue
Expand Down Expand Up @@ -80,6 +81,7 @@ subfolder
subpath
textdocument
truetype
tsbuildInfo
tslib
typechecking
unelevated
Expand Down
4 changes: 3 additions & 1 deletion cSpell.json → cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
"*.lock",
"*.log",
"*.vsix",
"*.tsv",
"**/__snapshots__/**",
"**/server.js",
"/samples",
"CHANGELOG.md",
"cSpell.json",
"cspell.json",
"cspell*.{json,yaml}",
".cspell*.{json,yaml}",
"fixtures/workspaces/**",
"languageCodes.ts",
"package-lock.json",
"fixtures/_server/sampleSourceFiles/**",
"packages/_server/sampleSourceFiles/**",
"packages/client/resources/**",
"packages/client/samples/**",
Expand Down
6 changes: 6 additions & 0 deletions fixtures/_server/sampleSourceFiles/Django/sampleGraphQL.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
query CurrentUserForLayout {
currentUser {
login
avatar_url
}
}
39 changes: 39 additions & 0 deletions fixtures/_server/sampleSourceFiles/cSpell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// cSpell Settings
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json",
// Version of the setting file. Always 0.1 or 0.2
"version": "0.2",
// language - current active spelling language
"language": "en",
// words - list of words to be always considered correct
"words": ["languageserver", "xregexp", "ramda", "gimuy", "gensequence"],
"globRoot": "../../..",
"ignorePaths": ["samples", "package-lock.json", ".eslintrc.js"],
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// For example "hte" should be "the"
"flagWords": ["hte"],
"dictionaryDefinitions": [
{
"name": "cpp2",
"path": "../dictionaries/cpp.txt"
}
],
"languageSettings": [
{
"languageId": "c",
"dictionaries": ["cpp2"]
},
{
"languageId": "cpp",
"dictionaries": ["cpp2"]
}
],
"overrides": [
{
"filename": "**/documentSettings.test.ts",
"language": "en-gb"
}
],
"import": ["./cspell-ext.json"]
}
31 changes: 31 additions & 0 deletions fixtures/_server/sampleSourceFiles/cspell-exclude-tests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json",
"version": "0.2",
"language": "en",
"globRoot": "../../..",
"words": ["languageserver", "xregexp", "ramda", "gimuy", "gensequence"],
"ignorePaths": ["samples", "package-lock.json", ".eslintrc.js"],
"flagWords": ["hte"],
"dictionaryDefinitions": [
{
"name": "cpp2",
"path": "../dictionaries/cpp.txt"
}
],
"languageSettings": [
{
"languageId": "c",
"dictionaries": ["cpp2"]
},
{
"languageId": "cpp",
"dictionaries": ["cpp2"]
}
],
"overrides": [
{
"filename": "**/documentSettings.test.ts",
"language": "en-gb"
}
]
}
4 changes: 4 additions & 0 deletions fixtures/_server/sampleSourceFiles/cspell-ext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"patterns": [{ "name": "test", "pattern": "TEST", "description": "Test Pattern from extension" }],
"words": ["TestWord"]
}
14 changes: 14 additions & 0 deletions fixtures/_server/sampleSourceFiles/overrides/cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"overrides": [
{
"name": "Override Typescript",
"filename": "**/*.ts",
"dictionaryDefinitions": [
{
"name": "Test Dictionary",
"path": "./words.txt"
}
]
}
]
}
5 changes: 5 additions & 0 deletions fixtures/_server/sampleSourceFiles/overrides/words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
encrypted
toggle
declare
concepts
NeXt
22 changes: 22 additions & 0 deletions fixtures/_server/sampleSourceFiles/sample.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <stdio.h>
int hcf(int n1, int n2);
int main()
{
int n1, n2;
printf("Enter two positive integers: ");
scanf("%d %d", &n1, &n2);

printf("G.C.D of %d and %d is %d.", n1, n2, hcf(n1, n2));
return 0;
}

// cspell: disable-next-line
// junkks

int hcf(int n1, int n2)
{
if (n2 != 0)
return hcf(n2, n1 % n2);
else
return n1;
}
20 changes: 20 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** @type {import('jest').Config} */
const config = {
roots: ['./src'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
// verbose: true,
testRegex: '(/__tests__/.*|\\.(test|spec|perf))\\.[jt]sx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
coverageReporters: ['html', 'json', ['lcov', { projectRoot: __dirname }], 'text'],
// "coverageProvider": "v8",
collectCoverageFrom: ['src/**/*.ts', '!**/*.test.helper.ts', '!**/node_modules/**', '!**/vendor/**'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/src/__mocks__/fileMock.js',
'\\.(css|less)$': '<rootDir>/src/__mocks__/styleMock.js',
},
maxConcurrency: 1,
};

module.exports = config;
11 changes: 11 additions & 0 deletions modules/__locale-resolver/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`index > index api 1`] = `
[
"formatLocale",
"isValidCode",
"lookupLocaleInfo",
"normalizeCode",
"parseLocale",
]
`;
Loading

0 comments on commit beddb1f

Please sign in to comment.