-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
279 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/cspell-eslint-plugin/fixtures/simple/eslint.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// ts-check | ||
// import eslint from '@eslint/js'; | ||
import cspellRecommended from '@cspell/eslint-plugin/recommended'; | ||
import tsESLint from 'typescript-eslint'; | ||
import Path from 'node:path'; | ||
|
||
/** | ||
* @type { import("eslint").Linter.Config[] } | ||
*/ | ||
export default tsESLint.config( | ||
// eslint.configs.recommended, | ||
{ | ||
files: ['**/*.*ts'], | ||
plugins: { | ||
'@typescript-eslint': tsESLint.plugin, | ||
}, | ||
languageOptions: { | ||
parser: tsESLint.parser, | ||
parserOptions: { | ||
projectService: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
rules: {}, | ||
}, | ||
cspellRecommended, | ||
{ | ||
files: ['**/*.*js', '**/*.*ts'], | ||
rules: { | ||
'@cspell/spellchecker': ['error'], | ||
}, | ||
}, | ||
); |
20 changes: 20 additions & 0 deletions
20
packages/cspell-eslint-plugin/fixtures/simple/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@internal/eslint-plugin-fixtures-simple", | ||
"version": "1.0.0", | ||
"description": "", | ||
"type": "module", | ||
"private": true, | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "pnpm eslint ." | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@cspell/eslint-plugin": "workspace:*", | ||
"@eslint/js": "^9.14.0", | ||
"eslint": "^9.14.0", | ||
"typescript-eslint": "^8.13.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use strict" | ||
|
||
const fs = require('fs'); | ||
const commander = require('commander'); | ||
|
||
export const help = ` | ||
This is some help. | ||
`; | ||
|
||
/** | ||
* run code | ||
*/ | ||
export function command(cmd) { | ||
const prompt = "Enter your name:"; | ||
|
||
return prompt; | ||
} | ||
|
||
command(commander); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import type { Rule } from 'eslint'; | ||
import { join, relative as rel } from 'path'; | ||
import { promises as fs } from 'fs'; | ||
import type { Literal, TemplateElement, Identifier, Node, Comment } from 'estree'; | ||
import { format } from 'util'; | ||
import path from 'path/posix'; | ||
|
||
export { configg } from 'prettier-config-cityssm'; | ||
|
||
const _utils = { | ||
path, | ||
format, | ||
}; | ||
|
||
let p = _utils.path.join.name; | ||
|
||
interface PluginRules { | ||
['cspell']: Rule.RuleModule; | ||
} | ||
|
||
const meta: Rule.RuleMetaData = { | ||
docs: { | ||
description: 'CSpell', | ||
}, | ||
}; | ||
|
||
/** | ||
* This is my Sample class. | ||
*/ | ||
export class MyClass { | ||
constructor(readonly name: string) {} | ||
|
||
get length() { | ||
return this.name.length; | ||
} | ||
|
||
getName() { | ||
return this.name; | ||
} | ||
|
||
asFilename() { | ||
return createFilename(this.name, '.txt'); | ||
} | ||
|
||
asRelative(toDir: string) { | ||
return rel(this.asFilename(), toDir); | ||
} | ||
|
||
async read(): Promise<string> { | ||
const content = await fs.readFile(this.asFilename(), 'utf-8'); | ||
return content; | ||
} | ||
} | ||
|
||
function createFilename(name: string, ext: string): string { | ||
return join('./', name + ext); | ||
} | ||
export class AppError extends Error { | ||
constructor(readonly msg: string) { | ||
super(msg); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/cspell-eslint-plugin/fixtures/simple/sampleESM.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { promises as fs } from 'fs'; | ||
|
||
export { configg } from 'prettier-config-cityssm'; | ||
|
||
export const LITERAL_NUM = 42; | ||
export const LITERAL_STR_SINGLE = 'Guide to the Galaxy'; | ||
export const LITERAL_STR_DOUBLE = 'To Infinity and Beyond'; | ||
export const LITERAL_COOKED = 'cafe\u0301'; | ||
export const UNDEFINED = undefined; | ||
export const NULL = null; | ||
export const BIG_INT = 1n; | ||
|
||
function mapDir(dir) { | ||
return `type: ${dir.isFile ? 'F' : ' '}${dir.isDirectory() ? 'D' : ' '} name: ${dir.name}`; | ||
} | ||
|
||
export async function listFiles() { | ||
const dirs = await fs.readdir('.', { withFileTypes: true }); | ||
const entries = dirs.map(mapDir); | ||
console.log(entries.join('\n')); | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/cspell-eslint-plugin/fixtures/simple/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "@tsconfig/node18/tsconfig.json", | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"rootDir": ".", | ||
"outDir": "dist" | ||
}, | ||
"include": ["."], | ||
"ignore": ["dist"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.