Skip to content

Commit fb9d5e8

Browse files
authored
feat: update dependencies and tests (#173)
1 parent 03f7e78 commit fb9d5e8

29 files changed

+4391
-4787
lines changed

.eslintrc

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
{
2-
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
3-
"root": true
2+
"extends": [
3+
"eslint:recommended",
4+
"prettier",
5+
"plugin:@typescript-eslint/recommended",
6+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
7+
"plugin:@typescript-eslint/strict"
8+
],
9+
"root": true,
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"project": ["./tsconfig.json"]
13+
},
14+
"ignorePatterns": ["dist", "jest.config.js", "src/helpers/__tests__/fixtures"]
415
}

.github/workflows/ci.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ jobs:
66
build-and-test:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v1
10-
- uses: actions/setup-node@v1
9+
- uses: actions/checkout@v3
10+
- uses: pnpm/action-setup@v2
11+
- uses: actions/setup-node@v3
1112
with:
12-
node-version: 14.x
13+
node-version-file: '.nvmrc'
14+
cache: 'pnpm'
1315
- name: Install
14-
run: yarn install --frozen-lockfile
16+
run: pnpm install
1517
- name: Lint
16-
run: yarn lint
18+
run: pnpm lint
1719
- name: Test
18-
run: yarn test
20+
run: pnpm test
1921
- name: Build
20-
run: yarn build
22+
run: pnpm build

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/.vscode
22
/node_modules
33
/coverage
4-
/lib
4+
/dist
55
npm-debug.log
66
yarn-error.log

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
pnpm lint-staged

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18.x

.prettierignore

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
src/helpers/__tests__/fixtures/*.less
2-
src/helpers/__tests__/fixtures/*.css
3-
src/helpers/__tests__/fixtures/*.scss
4-
/lib/
1+
pnpm-lock.yaml
2+
/dist/

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ const b = styles['my_other-class'];
9797

9898
Please note that no options are required. However, depending on your configuration, you may need to customise these options.
9999

100-
| Option | Default value | Description |
101-
| -------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------- |
102-
| `classnameTransform` | `asIs` | See [`classnameTransform`](#classnameTransform) below. |
103-
| `customMatcher` | `"\\.module\\.(c\|le\|sa\|sc)ss$"` | Changes the file extensions that this plugin processes. |
104-
| `customRenderer` | `false` | See [`customRenderer`](#customRenderer) below. |
105-
| `customTemplate` | `false` | See [`customTemplate`](#customTemplate) below. |
106-
| `jumpToDefinition` | `false` | Enables jump to definition, with limited compatibility. See [`jumpToDefinition`](#jumpToDefinition) below. |
107-
| `namedExports` | `true` | Enables named exports for compatible classnames. |
108-
| `dotenvOptions` | `{}` | Provides options for [`dotenv`](https://github.com/motdotla/dotenv#options). |
109-
| `postcssOptions` | `{}` | See [`postcssOptions`](#postcssOptions) below. |
110-
| `rendererOptions` | `{}` | See [`rendererOptions`](#rendererOptions) below. |
100+
| Option | Default value | Description |
101+
| -------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------ |
102+
| `classnameTransform` | `asIs` | See [`classnameTransform`](#classnameTransform) below. |
103+
| `customMatcher` | `"\\.module\\.(c\|le\|sa\|sc)ss$"` | Changes the file extensions that this plugin processes. |
104+
| `customRenderer` | `false` | See [`customRenderer`](#customRenderer) below. |
105+
| `customTemplate` | `false` | See [`customTemplate`](#customTemplate) below. |
106+
| `goToDefinition` | `false` | Enables jump to definition, with limited compatibility. See [`goToDefinition`](#goToDefinition) below. |
107+
| `namedExports` | `true` | Enables named exports for compatible classnames. |
108+
| `dotenvOptions` | `{}` | Provides options for [`dotenv`](https://github.com/motdotla/dotenv#options). |
109+
| `postcssOptions` | `{}` | See [`postcssOptions`](#postcssOptions) below. |
110+
| `rendererOptions` | `{}` | See [`rendererOptions`](#rendererOptions) below. |
111111

112112
```json
113113
{
@@ -193,7 +193,7 @@ The [internal `logger`](https://github.com/mrmckeb/typescript-plugin-css-modules
193193

194194
The `classes` object represents all the classnames extracted from the CSS Module. They are available if you want to add a custom representation of the CSS classes.
195195

196-
#### `jumpToDefinition`
196+
#### `goToDefinition`
197197

198198
This allows an editor like Visual Studio Code to jump to a classname's definition (file and line).
199199

jest.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
clearMocks: true,
3+
collectCoverageFrom: ['src/**/*.{ts}'],
4+
preset: 'ts-jest',
5+
setupFiles: ['<rootDir>/src/setup-tests.ts'],
6+
// See: https://github.com/sass/dart-sass/issues/1692
7+
testEnvironment: 'jest-environment-node-single-context',
8+
testPathIgnorePatterns: ['/node_modules/', '/fixtures/'],
9+
};

package.json

+47-61
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "typescript-plugin-css-modules",
33
"version": "3.4.0",
4-
"main": "lib/index.js",
4+
"main": "dist/index.js",
55
"author": "Brody McKee <mrmckeb@hotmail.com>",
66
"license": "MIT",
77
"description": "CSS modules support for TypeScript",
88
"homepage": "https://github.com/mrmckeb/typescript-plugin-css-modules",
9+
"packageManager": "pnpm@7.18.0",
910
"repository": {
1011
"type": "git",
1112
"url": "https://github.com/mrmckeb/typescript-plugin-css-modules"
@@ -22,34 +23,14 @@
2223
"typescript"
2324
],
2425
"files": [
25-
"lib"
26+
"dist"
2627
],
2728
"scripts": {
28-
"build": "rm -rf ./lib && tsc",
29-
"lint": "eslint --max-warnings 0 . && yarn prettier -c .",
30-
"prepublishOnly": "yarn build",
31-
"test": "jest"
32-
},
33-
"husky": {
34-
"hooks": {
35-
"pre-commit": "lint-staged",
36-
"pre-push": "yarn test"
37-
}
38-
},
39-
"jest": {
40-
"clearMocks": true,
41-
"collectCoverageFrom": [
42-
"src/**/*.{ts}"
43-
],
44-
"preset": "ts-jest",
45-
"setupFiles": [
46-
"<rootDir>/src/setup-tests.ts"
47-
],
48-
"testEnvironment": "node",
49-
"testPathIgnorePatterns": [
50-
"/node_modules/",
51-
"/fixtures/"
52-
]
29+
"build": "rm -rf ./dist && tsc --project tsconfig.build.json",
30+
"lint": "eslint --max-warnings 0 . && pnpm prettier -c .",
31+
"prepublishOnly": "pnpm build",
32+
"test": "jest",
33+
"prepare": "husky install"
5334
},
5435
"lint-staged": {
5536
"./src/**/*.ts": [
@@ -64,51 +45,56 @@
6445
"singleQuote": true,
6546
"trailingComma": "all"
6647
},
67-
"resolutions": {
68-
"postcss": "8.3.0"
69-
},
7048
"dependencies": {
71-
"dotenv": "^10.0.0",
49+
"dotenv": "^16.0.3",
7250
"icss-utils": "^5.1.0",
73-
"less": "^4.1.1",
51+
"less": "^4.1.3",
7452
"lodash.camelcase": "^4.3.0",
75-
"postcss": "^8.3.0",
53+
"postcss": "^8.4.19",
7654
"postcss-filter-plugins": "^3.0.1",
7755
"postcss-icss-keyframes": "^0.2.1",
7856
"postcss-icss-selectors": "^2.0.3",
79-
"postcss-load-config": "^3.0.1",
57+
"postcss-load-config": "^3.1.4",
8058
"reserved-words": "^0.1.2",
81-
"sass": "^1.32.13",
82-
"source-map-js": "^0.6.2",
83-
"stylus": "^0.54.8",
84-
"tsconfig-paths": "^3.9.0"
59+
"sass": "^1.56.1",
60+
"source-map-js": "^1.0.2",
61+
"stylus": "^0.59.0",
62+
"tsconfig-paths": "^4.1.1"
8563
},
8664
"devDependencies": {
87-
"@types/icss-utils": "^4.1.0",
88-
"@types/jest": "^26.0.23",
89-
"@types/less": "^3.0.2",
90-
"@types/lodash.camelcase": "^4.3.6",
91-
"@types/node": "^12.12.17",
92-
"@types/postcss-load-config": "^3.0.1",
93-
"@types/postcss-nested": "^4.2.3",
65+
"@types/icss-utils": "^5.1.0",
66+
"@types/jest": "^29.2.3",
67+
"@types/less": "^3.0.3",
68+
"@types/lodash.camelcase": "^4.3.7",
69+
"@types/node": "^18.11.10",
9470
"@types/reserved-words": "^0.1.0",
95-
"@types/sass": "^1.16.0",
96-
"@types/stylus": "^0.48.34",
97-
"@typescript-eslint/eslint-plugin": "^4.25.0",
98-
"@typescript-eslint/parser": "^4.25.0",
99-
"bootstrap": "5.0.1",
100-
"eslint": "^7.27.0",
101-
"eslint-config-prettier": "^8.3.0",
102-
"husky": "^4.2.5",
103-
"jest": "^27.0.2",
104-
"lint-staged": "^11.0.0",
105-
"postcss-import-sync2": "^1.1.0",
106-
"prettier": "^2.3.0",
107-
"sass-svg": "1.2.0",
108-
"ts-jest": "^27.0.1",
109-
"typescript": "^4.3.2"
71+
"@types/sass": "^1.43.1",
72+
"@types/stylus": "^0.48.38",
73+
"@typescript-eslint/eslint-plugin": "^5.45.0",
74+
"@typescript-eslint/parser": "^5.45.0",
75+
"bootstrap": "^5.2.3",
76+
"eslint": "^8.29.0",
77+
"eslint-config-prettier": "^8.5.0",
78+
"husky": "^8.0.2",
79+
"jest": "^29.3.1",
80+
"jest-environment-node-single-context": "^29.0.0",
81+
"lint-staged": "^13.0.3",
82+
"postcss-import-sync2": "^1.2.0",
83+
"postcss-nested": "^4.2.3",
84+
"prettier": "^2.8.0",
85+
"sass-svg": "^1.2.0",
86+
"ts-jest": "^29.0.3",
87+
"typescript": "^4.9.3"
11088
},
11189
"peerDependencies": {
112-
"typescript": ">=3.0.0"
90+
"typescript": ">=3.9.0"
91+
},
92+
"pnpm": {
93+
"peerDependencyRules": {
94+
"ignoreMissing": [
95+
"@popperjs/core",
96+
"node-sass"
97+
]
98+
}
11399
}
114100
}

0 commit comments

Comments
 (0)