Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f31748b
chore: remove .cjs files
Swanand01 Apr 1, 2025
9fc4178
refactor: add .ts files
Swanand01 Apr 1, 2025
71702bf
refactor: update build file
Swanand01 Apr 1, 2025
82bfbbc
feat: add prettier config
Swanand01 Apr 1, 2025
d8008eb
feat: add tsconfig
Swanand01 Apr 1, 2025
925fb1c
refactor: update package.json
Swanand01 Apr 1, 2025
7249a6b
refactor: add eslint rule to ignore console logs
Swanand01 Apr 1, 2025
83eaacb
chore: update package-lock
Swanand01 Apr 1, 2025
cf89e17
chore: add changeset
Swanand01 Apr 1, 2025
0ef81ff
Merge branch 'develop' into feat/migrate-cli-to-ts
Swanand01 Apr 1, 2025
af667b7
chore: update changeset
Swanand01 Apr 1, 2025
2cca0ba
Merge branch 'feat/migrate-cli-to-ts' of https://github.com/Swanand01…
Swanand01 Apr 1, 2025
741af7d
fix: changeset
Swanand01 Apr 1, 2025
bba0ffb
refactor: update ESLint config for .cjs formatting
Swanand01 Apr 3, 2025
3673193
refactor: remove exports
Swanand01 Apr 3, 2025
58313bb
chore: update package-lock
Swanand01 Apr 3, 2025
5d0cfcd
chore: format
Swanand01 Apr 3, 2025
f623611
Merge branch 'develop' into feat/migrate-cli-to-ts
justlevine Apr 3, 2025
49eff4e
Merge remote-tracking branch 'upstream/develop' into feat/migrate-cli…
Swanand01 Apr 4, 2025
c0419f1
chore: format
Swanand01 Apr 4, 2025
603c1f1
feat : add import/no-default-export eslint rule.
Ta5r Apr 4, 2025
bd598d5
chore : updated files for no-default-exports.
Ta5r Apr 4, 2025
5e2df69
chore : add changeset.
Ta5r Apr 4, 2025
33c10fc
Merge branch 'develop' into feat/import-no-default-export
Ta5r Apr 4, 2025
0b88cc1
chore : reorder-import
Ta5r Apr 4, 2025
29025e1
temp : fix failing gh actions
Ta5r Apr 4, 2025
89eaa67
fix : export default for codegen config and baseConfig
Ta5r Apr 4, 2025
a941d8c
Merge branch 'develop' into pr/Swanand01/140
justlevine Apr 4, 2025
ef971fe
chore: cleanup up eslint ruleset
justlevine Apr 4, 2025
9deea80
Merge branch 'develop' into feat/migrate-cli-to-ts
justlevine Apr 4, 2025
123a436
Merge branch 'develop' into feat/import-no-default-export
justlevine Apr 4, 2025
fd0f6da
Merge pull request #147 from Ta5r/feat/import-no-default-export
Ta5r Apr 8, 2025
964c697
Merge remote-tracking branch 'upstream/develop' into feat/migrate-cli…
Swanand01 Apr 9, 2025
73d1c2a
refactor: remove default exports in favor of named exports
Swanand01 Apr 9, 2025
ac67767
Merge branch 'develop' into pr/Swanand01/140
justlevine Apr 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shy-sites-write.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"snapwp": patch
---

feat: Convert CLI to TypeScript
65 changes: 39 additions & 26 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,7 @@ module.exports = {
},
overrides: [
{
files: '**/*.test.ts',
env: {
jest: true,
},
},
{
files: [ '**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx' ],
files: [ '**/*.{js,jsx,ts,tsx,cjs,mjs,cts,mts}' ],
// Mandate doc block for arrow functions, class declarations, class expressions, function expressions, and method definition.
rules: {
'jsdoc/require-jsdoc': [
Expand All @@ -159,25 +153,10 @@ module.exports = {
],
},
},
// Rules for bin and cli files.
{
files: [ 'bin/**/*.js', 'bin/**/*.mjs', 'packages/cli/src/*.cjs' ],
rules: {
// Enable the use of console log.
'no-console': 'off',
// Enable the use of process-env.
'n/no-process-env': 'off',
},
},
// Disable n/no-process-env for `codegen.ts` file.
{
files: [ '**/codegen.ts', '**/*.test.*', '**/jest.setup.js' ],
rules: {
'n/no-process-env': 'off',
},
},

// Typescript files.
{
files: [ '**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts' ],
files: [ '**/*.{ts,tsx,cts,mts}' ],
excludedFiles: [
'**/codegen.ts',
'packages/query/src/**/tests/*',
Expand All @@ -192,12 +171,46 @@ module.exports = {
project: true,
},
},

// CLI package TypeScript files
{
files: [
'**/packages/cli/src/**/*.{ts,cts,mts}',
'**/packages/cli/build.cjs',
],
rules: {
'n/no-process-env': 'off',
'no-console': 'off',
},
},

// Jest files.
{
files: [ '**/*.test.ts' ],
env: {
jest: true,
},
},

// E2E test utility files
{
files: [ '**/packages/e2e-tests/src/utils/*.ts' ],
files: [ '**/packages/e2e-tests/src/utils/*.{ts,cts,mts}' ],
rules: {
'n/no-process-env': 'off',
'no-console': 'off',
},
},

// Config and setup files
{
files: [
'**/codegen.ts',
'**/*.test.{js,jsx,ts,tsx,cjs,mjs,cts,mts}',
'**/jest.setup.{js,cjs,mjs}',
],
rules: {
'n/no-process-env': 'off',
},
},
],
};
20 changes: 10 additions & 10 deletions config/import-resolver.cjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/**
* External dependencies.
*/
const resolverTS = require( 'eslint-import-resolver-typescript' );
const path = require( 'path' );
const resolverTS = require( 'eslint-import-resolver-typescript' );

exports.interfaceVersion = 2;

/**
* Eslint configuration for resolving TypeScript aliases.
*
* @param source Import string.
* @param file File-path in which alias is used.
* @param config configuration.
* @param {string} source Import string.
* @param {string} file File-path in which alias is used.
* @param {Object} config configuration.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file not included in the eslint config before?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope 😬

*
* @return Resolved path.
*/
exports.resolve = function ( source, file, config ) {
/**
* Creates a path resolver.
*
* @param sourcePath Import string.
* @param {string} sourcePath Import string.
*
* @return Path resolver.
*/
Expand Down Expand Up @@ -53,11 +53,11 @@ exports.resolve = function ( source, file, config ) {
/**
* Resolves TS paths.
*
* @param source Import string.
* @param alias Alias to search.
* @param aliasPath Alias path.
* @param file File-path in which alias is used.
* @param resolve Path resolver.
* @param {string} source Import string.
* @param {string} alias Alias to search.
* @param {string} aliasPath Alias path.
* @param {string} file File-path in which alias is used.
* @param {Function} resolve Path resolver.
*
* @return Resolved path on success | False if alias is not found in import string.
*/
Expand Down
Loading