Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
40 changes: 20 additions & 20 deletions .github/scripts/validate-fixtures-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@ const path = require('path');
*/
function extractJsonFromHttpFile(filePath) {
const content = fs.readFileSync(filePath, 'utf8');

// Split by double newline to separate headers from body
const parts = content.split(/\n\s*\n/, 2);

if (parts.length < 2) {
return null;
}

const body = parts[1].trim();
if (!body) {
return null;
}

// Check if content-type indicates JSON
const headers = parts[0];
const isJsonContentType = headers.includes('Content-Type: application/json') ||
const isJsonContentType = headers.includes('Content-Type: application/json') ||
headers.includes('content-type: application/json');

// If no explicit JSON content-type, try to parse as JSON anyway
// (some files might have JSON without proper content-type header)
if (!isJsonContentType) {
try {
JSON.parse(body);
return body;
} catch (e) {
} catch (_e) {
return null;
}
}

return body;
}

Expand All @@ -49,22 +49,22 @@ function extractJsonFromHttpFile(filePath) {
*/
function findHttpFiles(dir) {
const files = [];

function traverse(currentDir) {
const items = fs.readdirSync(currentDir);

for (const item of items) {
const fullPath = path.join(currentDir, item);
const stat = fs.statSync(fullPath);

if (stat.isDirectory()) {
traverse(fullPath);
} else if (item.endsWith('.http')) {
files.push(fullPath);
}
}
}

traverse(dir);
return files;
}
Expand All @@ -77,21 +77,21 @@ function validateJsonInFixtures(fixturesDir) {
const errors = [];
let filesChecked = 0;
let jsonFilesFound = 0;

console.log(`🔍 Scanning for HTTP fixtures in: ${fixturesDir}`);

const httpFiles = findHttpFiles(fixturesDir);

for (const filePath of httpFiles) {
filesChecked++;
const jsonContent = extractJsonFromHttpFile(filePath);

if (!jsonContent) {
continue;
}

jsonFilesFound++;

try {
JSON.parse(jsonContent);
console.log(`✅ ${filePath}`);
Expand All @@ -101,12 +101,12 @@ function validateJsonInFixtures(fixturesDir) {
errors.push(errorMsg);
}
}

console.log('\n📊 Summary:');
console.log(`Files checked: ${filesChecked}`);
console.log(`JSON files found: ${jsonFilesFound}`);
console.log(`Validation errors: ${errors.length}`);

if (errors.length > 0) {
console.log('\n❌ Errors found:');
errors.forEach(error => console.log(` ${error}`));
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
name: Lint JavaScript
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Install Node
uses: actions/setup-node@v6
with:
node-version-file: '.tool-versions'
cache: yarn
- name: Install JS Deps
run: yarn install --frozen-lockfile
- name: Run ESLint
run: yarn lint

lint_openapi:
name: Lint OpenAPI Spec
runs-on: ubuntu-latest
Expand Down
39 changes: 39 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import js from '@eslint/js';
import pluginVue from 'eslint-plugin-vue';
import globals from 'globals';

export default [
{
ignores: ['dist/', 'output/', 'node_modules/', 'tmp/'],
},
js.configs.recommended,
...pluginVue.configs['flat/recommended'],
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
},
},
rules: {
'no-unused-vars': ['error', { argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' }],
'vue/multi-word-component-names': 'off',
'vue/max-attributes-per-line': 'off',
'vue/html-self-closing': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/v-bind-style': 'off',
'vue/attributes-order': 'off',
'vue/no-v-html': 'off',
},
},
{
files: ['webpack.config.cjs', '.github/**/*.js'],
languageOptions: {
sourceType: 'commonjs',
globals: {
...globals.node,
},
},
},
];
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@
"name": "dnsimple-developer",
"version": "0.0.1",
"private": true,
"type": "module",
"devDependencies": {
"@eslint/js": "^9.18.0",
"@fortawesome/fontawesome-free": "^7.1.0",
"@redocly/cli": "^2.14.4",
"@vue/compiler-sfc": "^3.4.21",
"concurrently": "^9.2.1",
"copy-webpack-plugin": "^13.0.1",
"eslint": "^9.18.0",
"eslint-plugin-vue": "^9.32.0",
"globals": "^15.14.0",
"tachyons": "^4.12.0",
"vue-loader": "^17.4.2",
"webpack": "^5.104.1",
"webpack-cli": "^6.0.1"
},
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"live": "concurrently 'bundle exec nanoc live' 'bundle exec rake compile'",
"build": "npx webpack",
"openapi-lint": "redocly lint content/v2/openapi.yml"
Expand Down
2 changes: 1 addition & 1 deletion src/components/tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ tab }}
</div>
<div class="tab-content ba pa3 b--moon-gray">
<div v-for="(tab, index) in tabs" :key="`tab${index}`" v-if="currentTab === tab">
<div v-for="(tab, index) in tabs" :key="`tab${index}`" v-show="currentTab === tab">
<div v-html="contents[index]"></div>
</div>
</div>
Expand Down
File renamed without changes.
Loading
Loading