Skip to content

Commit a40668c

Browse files
committed
Some missed cleanup, missing dev dependencies, and fixed build.
1 parent f23457b commit a40668c

File tree

18 files changed

+1996
-174
lines changed

18 files changed

+1996
-174
lines changed

.eslintrc.js

Lines changed: 263 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,267 @@
11
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: 'tsconfig.json',
5+
tsconfigRootDir: '.',
6+
sourceType: 'module',
7+
},
8+
plugins: ['@typescript-eslint/eslint-plugin'],
29
extends: [
3-
'../../.eslintrc.js',
10+
'plugin:@typescript-eslint/recommended',
11+
'plugin:prettier/recommended',
412
],
13+
root: true,
14+
env: {
15+
node: true,
16+
jest: true,
17+
},
18+
ignorePatterns: ['.eslintrc.js', 'scripts/*'],
19+
rules: {
20+
'no-var': 'warn',
21+
'object-shorthand': ['warn', 'properties'],
22+
23+
'accessor-pairs': ['error', { setWithoutGet: true, enforceForClassMembers: true }],
24+
'array-bracket-spacing': ['error', 'never'],
25+
'array-bracket-newline': ['error', { multiline: true }],
26+
'array-callback-return': ['error', {
27+
allowImplicit: false,
28+
checkForEach: false,
29+
}],
30+
'arrow-spacing': ['error', { before: true, after: true }],
31+
'block-spacing': ['error', 'always'],
32+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
33+
'camelcase': ['error', {
34+
allow: ['^UNSAFE_'],
35+
properties: 'never',
36+
ignoreGlobals: true,
37+
}],
38+
'comma-dangle': ['error', {
39+
arrays: 'always-multiline',
40+
objects: 'always-multiline',
41+
imports: 'always-multiline',
42+
exports: 'always-multiline',
43+
functions: 'always-multiline',
44+
}],
45+
'comma-spacing': ['error', { before: false, after: true }],
46+
'comma-style': ['error', 'last'],
47+
'computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
48+
'constructor-super': 'error',
49+
'curly': ['error', 'multi-line'],
50+
'default-case-last': 'error',
51+
'dot-location': ['error', 'property'],
52+
'eol-last': 'error',
53+
'eqeqeq': ['error', 'always', { null: 'ignore' }],
54+
'func-call-spacing': ['error', 'never'],
55+
'func-style': ['error', 'expression', { allowArrowFunctions: true }],
56+
'generator-star-spacing': ['error', { before: true, after: true }],
57+
'indent': ['error', 2, {
58+
SwitchCase: 1,
59+
VariableDeclarator: 1,
60+
outerIIFEBody: 1,
61+
MemberExpression: 1,
62+
FunctionDeclaration: { parameters: 1, body: 1 },
63+
FunctionExpression: { parameters: 1, body: 1 },
64+
CallExpression: { arguments: 1 },
65+
ArrayExpression: 1,
66+
ObjectExpression: 1,
67+
ImportDeclaration: 1,
68+
flatTernaryExpressions: false,
69+
ignoreComments: false,
70+
ignoredNodes: [
71+
'TemplateLiteral *',
72+
'JSXElement',
73+
'JSXElement > *',
74+
'JSXAttribute',
75+
'JSXIdentifier',
76+
'JSXNamespacedName',
77+
'JSXMemberExpression',
78+
'JSXSpreadAttribute',
79+
'JSXExpressionContainer',
80+
'JSXOpeningElement',
81+
'JSXClosingElement',
82+
'JSXFragment',
83+
'JSXOpeningFragment',
84+
'JSXClosingFragment',
85+
'JSXText',
86+
'JSXEmptyExpression',
87+
'JSXSpreadChild',
88+
'PropertyDefinition[decorators]'
89+
],
90+
offsetTernaryExpressions: true,
91+
}],
92+
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
93+
'keyword-spacing': ['error', { before: true, after: true }],
94+
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
95+
'multiline-ternary': ['error', 'always-multiline'],
96+
'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
97+
'new-parens': 'error',
98+
'no-array-constructor': 'error',
99+
'no-async-promise-executor': 'error',
100+
'no-caller': 'error',
101+
'no-case-declarations': 'error',
102+
'no-class-assign': 'error',
103+
'no-compare-neg-zero': 'error',
104+
'no-cond-assign': 'error',
105+
'no-const-assign': 'error',
106+
'no-constant-condition': ['error', { checkLoops: false }],
107+
'no-control-regex': 'error',
108+
'no-debugger': 'error',
109+
'no-delete-var': 'error',
110+
'no-dupe-args': 'error',
111+
'no-dupe-class-members': 'error',
112+
'no-dupe-keys': 'error',
113+
'no-duplicate-case': 'error',
114+
'no-useless-backreference': 'error',
115+
'no-empty': ['error', { allowEmptyCatch: true }],
116+
'no-empty-character-class': 'error',
117+
'no-empty-pattern': 'error',
118+
'no-eval': 'error',
119+
'no-ex-assign': 'error',
120+
'no-extend-native': 'error',
121+
'no-extra-bind': 'error',
122+
'no-extra-boolean-cast': 'error',
123+
'no-extra-parens': ['error', 'functions'],
124+
'no-fallthrough': 'error',
125+
'no-floating-decimal': 'error',
126+
'no-func-assign': 'error',
127+
'no-global-assign': 'error',
128+
'no-implied-eval': 'error',
129+
'no-import-assign': 'error',
130+
'no-invalid-regexp': 'error',
131+
'no-irregular-whitespace': 'error',
132+
'no-iterator': 'error',
133+
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
134+
'no-lone-blocks': 'error',
135+
'no-loss-of-precision': 'error',
136+
'no-misleading-character-class': 'error',
137+
'no-useless-catch': 'error',
138+
'no-mixed-operators': ['error', {
139+
groups: [
140+
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
141+
['&&', '||'],
142+
['in', 'instanceof'],
143+
],
144+
allowSamePrecedence: true,
145+
}],
146+
'no-mixed-spaces-and-tabs': 'error',
147+
'no-multi-spaces': 'error',
148+
'no-multi-str': 'error',
149+
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
150+
'no-new': 'error',
151+
'no-new-func': 'error',
152+
'no-new-object': 'error',
153+
'no-new-symbol': 'error',
154+
'no-new-wrappers': 'error',
155+
'no-obj-calls': 'error',
156+
'no-octal': 'error',
157+
'no-octal-escape': 'error',
158+
'no-proto': 'error',
159+
'no-redeclare': ['error', { builtinGlobals: false }],
160+
'no-regex-spaces': 'error',
161+
'no-return-assign': ['error', 'except-parens'],
162+
'no-self-assign': ['error', { props: true }],
163+
'no-self-compare': 'error',
164+
'no-sequences': 'error',
165+
'no-shadow-restricted-names': 'error',
166+
'no-sparse-arrays': 'error',
167+
'no-tabs': 'error',
168+
'no-template-curly-in-string': 'error',
169+
'no-this-before-super': 'error',
170+
'no-throw-literal': 'error',
171+
'no-trailing-spaces': 'error',
172+
'no-undef': 'error',
173+
'no-undef-init': 'error',
174+
'no-unexpected-multiline': 'error',
175+
'no-unmodified-loop-condition': 'error',
176+
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
177+
'no-unreachable': 'error',
178+
'no-unreachable-loop': 'error',
179+
'no-unsafe-finally': 'error',
180+
'no-unsafe-negation': 'error',
181+
'no-unused-expressions': ['error', {
182+
allowShortCircuit: true,
183+
allowTernary: true,
184+
allowTaggedTemplates: true,
185+
}],
186+
'no-unused-vars': ['error', {
187+
args: 'none',
188+
caughtErrors: 'none',
189+
ignoreRestSiblings: true,
190+
vars: 'all',
191+
}],
192+
'no-useless-call': 'error',
193+
'no-useless-computed-key': 'error',
194+
'no-useless-rename': 'error',
195+
'no-useless-return': 'error',
196+
'no-void': ['error', { allowAsStatement: true }],
197+
'no-whitespace-before-property': 'error',
198+
'no-with': 'error',
199+
'object-curly-newline': ['error', { multiline: true, consistent: true }],
200+
'object-curly-spacing': ['error', 'always'],
201+
'object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
202+
'one-var': ['error', { initialized: 'never' }],
203+
'operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before', '|>': 'before' } }],
204+
'padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
205+
'prefer-const': ['error', { destructuring: 'all' }],
206+
'prefer-promise-reject-errors': 'error',
207+
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
208+
'quote-props': ['error', 'as-needed'],
209+
'quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
210+
'rest-spread-spacing': ['error', 'never'],
211+
'semi': ['error', 'always'],
212+
'semi-spacing': ['error', { before: false, after: true }],
213+
'space-before-blocks': ['error', 'always'],
214+
'space-before-function-paren': ['error', {
215+
'anonymous': 'always',
216+
'named': 'never',
217+
'asyncArrow': 'always',
218+
}],
219+
'space-in-parens': ['error', 'never'],
220+
'space-infix-ops': 'error',
221+
'space-unary-ops': ['error', { words: true, nonwords: false }],
222+
'spaced-comment': ['error', 'always', {
223+
line: { markers: ['*package', '!', '/', ',', '='] },
224+
block: { balanced: true, markers: ['*package', '!', ',', ':', '::', 'flow-include'], exceptions: ['*'] },
225+
}],
226+
'symbol-description': 'error',
227+
'template-curly-spacing': ['error', 'never'],
228+
'template-tag-spacing': ['error', 'never'],
229+
'unicode-bom': ['error', 'never'],
230+
'use-isnan': ['error', {
231+
enforceForSwitchCase: true,
232+
enforceForIndexOf: true,
233+
}],
234+
'valid-typeof': ['error', { requireStringLiterals: true }],
235+
'wrap-iife': ['error', 'any', { functionPrototypeMethods: true }],
236+
'yield-star-spacing': ['error', 'both'],
237+
238+
'@typescript-eslint/interface-name-prefix': 'off',
239+
'@typescript-eslint/explicit-function-return-type': 'off',
240+
'@typescript-eslint/explicit-module-boundary-types': 'off',
241+
'@typescript-eslint/no-explicit-any': 'off',
242+
'@typescript-eslint/no-non-null-assertion': 'off',
243+
'@typescript-eslint/no-unused-vars': 'error',
244+
'prettier/prettier': [
245+
0,
246+
{
247+
'endOfLine': 'auto',
248+
},
249+
],
250+
"@typescript-eslint/naming-convention": [
251+
"error",
252+
{
253+
"selector": [
254+
"classProperty",
255+
"typeProperty",
256+
"classMethod",
257+
"objectLiteralMethod",
258+
"typeMethod",
259+
"accessor",
260+
"enumMember"
261+
],
262+
"format": ["strictCamelCase"],
263+
"modifiers": ["requiresQuotes"]
264+
}
265+
]
266+
},
5267
};

README_INTERNAL.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,26 @@ You should see "HELLO WORLD" at the bottom of the README!
7272

7373
## Conclusion
7474

75-
That's it! Happy hacking!
75+
That's it! Happy hacking!
76+
77+
# PolyAPI TypeScript/JavaScript Client
78+
79+
## Adding a new kind of deployable for `poly prepare` and `poly sync`
80+
81+
1. Update user-facing typedef exports in `types.ts` to add a new type and any custom configuration it might have. Follow the existing naming convention: `PolyThing`.
82+
83+
2. Update typedefs in `src/deployments.ts`.
84+
85+
a. Add type to DeployableTypes (matching collection id as used in canopy collection url).
86+
87+
b. Add type to DeployableTypeNames matching the type added in the `types.ts` file.
88+
89+
c. Add entry to DeployableTypeEntries mapping the new DeployableTypeName to the new DeployableType
90+
91+
3. Update transpiler to support the new type and add a function if you need to parse more than the type and config object. See `parseDeployable` in `src/transpiler.ts`.
92+
93+
4. Add function to write this new type of deployable back to its source file. See `writeUpdatedDeployable` in `src/deployments.ts`.
94+
95+
5. Update poly prepare to support filling in missing details for this new type. See `fillInMissingDetails` in `src/commands/prepare.ts`.
96+
97+
6. Update poly sync to support syncing and removing this new type. See `syncDeployableAndGetId` and `removeDeployable` in `src/commands/sync.ts`.

0 commit comments

Comments
 (0)