Skip to content

Commit

Permalink
Lint tests/blueprints project
Browse files Browse the repository at this point in the history
  • Loading branch information
gitKrystan committed Oct 26, 2023
1 parent bccaa12 commit f804dd2
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 0 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ MOCK_DATA.json
# unconventional
blueprints/
vendor/
!tests/blueprints/

# prettier is reporting syntax errors in these
*.yml
Expand Down
1 change: 1 addition & 0 deletions config/eslint/ignore.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const RULES = [
// # unconventional js
'blueprints/',
'!tests/blueprints/',
'vendor',

// # Declaration files
Expand Down
20 changes: 20 additions & 0 deletions config/eslint/mocha.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const isolation = require('./isolation.cjs');

function defaults(config = {}) {
return {
files: config.files || ['tests/**/*-test.{js,ts}'],
plugins: ['mocha'],
extends: ['plugin:mocha/recommended'],
env: {
node: true,
},
rules: {
// We use setup to set up beforeEach hooks, etc, which should be OK
'mocha/no-setup-in-describe': 'off',
},
};
}

module.exports = {
defaults,
};
1 change: 1 addition & 0 deletions config/eslint/qunit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function defaults(config = {}) {
isolation.rules({
allowedImports: ['@ember/debug', '@ember/test-helpers', 'qunit'],
}),
config?.rules,
{}
),
};
Expand Down
1 change: 1 addition & 0 deletions config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-mocha": "^10.2.0",
"eslint-plugin-n": "^16.2.0",
"eslint-plugin-qunit": "^8.0.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
Expand Down
21 changes: 21 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions tests/blueprints/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const base = require('@warp-drive/internal-config/eslint/base.cjs');
const ignore = require('@warp-drive/internal-config/eslint/ignore.cjs');
const imports = require('@warp-drive/internal-config/eslint/imports.cjs');
const isolation = require('@warp-drive/internal-config/eslint/isolation.cjs');
const mocha = require('@warp-drive/internal-config/eslint/mocha.cjs');
const node = require('@warp-drive/internal-config/eslint/node.cjs');
const parser = require('@warp-drive/internal-config/eslint/parser.cjs');
const qunit = require('@warp-drive/internal-config/eslint/qunit.cjs');

module.exports = {
...parser.defaults(),

plugins: [...base.plugins(), ...imports.plugins()],
extends: [...base.extend()],
rules: Object.assign(base.rules(), imports.rules(), isolation.rules(), {}),

ignorePatterns: ignore.ignoreRules(),

overrides: [
node.config(),
node.defaults(),
qunit.defaults({
files: ['fixtures/**/*.{js,ts}'],
rules: {
// Fixing these would cause test failures
'prefer-const': 'off',
'simple-import-sort/imports': 'off',
},
}),
mocha.defaults(),
],
};
2 changes: 2 additions & 0 deletions tests/blueprints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"license": "MIT",
"author": "",
"scripts": {
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs --report-unused-disable-directives",
"test:blueprints": "mocha tests",
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
Expand Down Expand Up @@ -89,6 +90,7 @@
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@warp-drive/core-types": "workspace:5.5.0-alpha.11",
"@warp-drive/internal-config": "workspace:5.5.0-alpha.11",
"ember-cli": "~5.3.0",
"ember-cli-blueprint-test-helpers": "^0.19.2",
"ember-inflector": "^4.0.2",
Expand Down

0 comments on commit f804dd2

Please sign in to comment.