-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add common Sass TypeScript configuration to the analysis package
- Loading branch information
Showing
12 changed files
with
106 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"extends": "./node_modules/gts/", | ||
"plugins": ["import"], | ||
"rules": { | ||
"@typescript-eslint/explicit-function-return-type": [ | ||
"error", | ||
{"allowExpressions": true} | ||
], | ||
"func-style": ["error", "declaration"], | ||
"prefer-const": ["error", {"destructuring": "all"}], | ||
// It would be nice to sort import declaration order as well, but that's not | ||
// autofixable and it's not worth the effort of handling manually. | ||
"sort-imports": ["error", {"ignoreDeclarationSort": true}], | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["**/*.ts"], | ||
"rules": { | ||
"import/no-commonjs": "error" | ||
} | ||
} | ||
] | ||
} |
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,3 @@ | ||
module.exports = { | ||
...require('gts/.prettierrc.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 |
---|---|---|
@@ -1,15 +1,65 @@ | ||
This package provides a shared set of analysis options for use by Sass team | ||
packages. To use it, add it as a Git dependency to your `pubspec.yaml`: | ||
This package provides a shared static analysis configuration for use by Sass | ||
team Dart and TypeScript packages. | ||
|
||
## Use from Dart | ||
|
||
Add this as a Git dependency to your `pubspec.yaml`: | ||
|
||
```yaml | ||
dev_dependencies: | ||
sass_analysis: | ||
git: {url: | ||
https://github.com/sass/dart-sass.git, path: analysis} | ||
git: {url: https://github.com/sass/dart-sass.git, path: analysis} | ||
``` | ||
and include it in your `analysis_options.yaml`: | ||
|
||
```yaml | ||
include: package:sass_analysis/analysis_options.yaml | ||
``` | ||
|
||
## Use from TypeScript | ||
|
||
Add this and [gts] as Git dependencies to your `package.json`, then initialize | ||
gts: | ||
|
||
[gts]: https://github.com/google/gts | ||
|
||
```sh | ||
$ npm i --save-dev gts 'https://gitpkg.vercel.app/sass/dart-sass/analysis?main' | ||
$ npx gts init | ||
``` | ||
|
||
Then edit the configuration files to use Sass-specific customizations instead of | ||
the gts defaults: | ||
|
||
* `eslintrc.json`: | ||
|
||
```json | ||
{ | ||
"extends": "./node_modules/sass-analysis/" | ||
} | ||
``` | ||
|
||
* `.prettierrc.js`: | ||
|
||
```json | ||
module.exports = { | ||
...require(sass-analysis/.prettierrc.js') | ||
} | ||
``` | ||
|
||
* `tsconfig.json`: | ||
|
||
```json | ||
{ | ||
"extends": "./node_modules/sass-analysis/tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"outDir": "build" | ||
}, | ||
"include": [ | ||
"src/**/*.ts", | ||
"test/**/*.ts" | ||
] | ||
} | ||
``` |
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 @@ | ||
{ | ||
"name": "sass-analysis", | ||
"version": "0.0.0", | ||
"description": "Shared static analysis options for Sass team packages.", | ||
"dependencies": { | ||
"eslint-plugin-import": "^2.30.0", | ||
"gts": "^5.0.0", | ||
"jsonc-parser": "^3.3.1" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "./node_modules/gts/tsconfig-google.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 |
---|---|---|
@@ -1,14 +1,3 @@ | ||
{ | ||
"extends": "./node_modules/gts/", | ||
"rules": { | ||
"@typescript-eslint/explicit-function-return-type": [ | ||
"error", | ||
{"allowExpressions": true} | ||
], | ||
"func-style": ["error", "declaration"], | ||
"prefer-const": ["error", {"destructuring": "all"}], | ||
// It would be nice to sort import declaration order as well, but that's not | ||
// autofixable and it's not worth the effort of handling manually. | ||
"sort-imports": ["error", {"ignoreDeclarationSort": true}], | ||
} | ||
"extends": "./node_modules/sass-analysis/" | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
...require('gts/.prettierrc.json'), | ||
...require('sass-analysis/.prettierrc.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
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